How to link to other Java applications like com.android.music?

I am trying to develop an application to complement the built-in music player. I used git to download the com.android.music package and looked around its code. I can start the music player by copying part of my code and launching the actions with intentions.

Now I need to make a pen for the current view. In the file MusicUtils.java I see a line with the inscription

View nowPlayingView = a.findViewById(R.id.nowplaying);

I would like to do the same. Only I do not have access to the file R.java, so I can not write, for example. R.id.nowplaying. How should I do it? How can I refer to Rjava music players? I know that R.java stuff is declared public, so this should not be a problem. Correctly?

Is it possible? I saw this related question, and now I'm wondering: How to download com.android.music code in Eclipse and compile it?

Btw, I work against the Android 2.2 SDK, but it would be useful to know if the answer is different with older versions such as 1.5. Thank.

+3
source share
3 answers

You cannot get a handle Viewthat is not in your process, even if you have access to the class R.

+6
source

R - , Android XML, /res . , git, MusicUtils.java, , /res/layout/. XML, , "nowplaying".

"res/layout", Android R, R.id.nowplaying, .

+1

, R . , android android.R.<type>.<name>.

0
source

Source: https://habr.com/ru/post/1767257/


All Articles