views:

43

answers:

2

I am trying to develop an app to supplement the built-in music player. I've used git to download the com.android.music package and looked around at its code. I can launch the music player by copying some of its code and launching activities with intents.

Now what I need to do is get a handle to its current view. In the MusicUtils.java file, I see a line that says

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

I'd like to do the same thing. Only I don't have access to the R.java file, so I can't write e.g. R.id.nowplaying. How do I do this? How do I reference the music players R.java? I do know the R.java stuff is declared public so that shouldn't be a problem. Right?

Is it even possible? I saw this related question and am now wondering: http://stackoverflow.com/questions/2437271/how-to-load-com-android-music-code-into-eclipse-and-compile

Btw, I'm working against the Android 2.2 SDK, but it'd be helpful to know if the answer is different for older versions such as 1.5. Thanks.

+4  A: 

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

Romain Guy
A: 

You have the source code, so take the resources and build your own R file. Also, you can access android system resources by android.R.<type>.<name> as well.

schwiz