Well android resources are in android.R package . always.
To pass a resource ID i need to know what it is. To find out what it
is - i need reference R. May be i didn't get what exactly you're
suggesting.
Here is simple example - i have app with package1. i want to use same
activity with package2-n apps. How i rewrite reference to R. so it can
universal ? Now as you can see i put two imports to packages where i
expect R will be generated by ant.

package com.test;
import android.app.Activity;
import android.os.Bundle;

import android.widget.Button;

// Imports to resolve R
import com.test.package1.*;
import com.test.package2.*;

public class Test extends Activity {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Button click = (Button) findViewById(R.id.click_btn);

    }

}

On May 14, 1:52 pm, "Mark Murphy" <[email protected]> wrote:
> > So now i want to create two applications with intent
> > to put them on the market. To do that i'll have to have different
> > packages in manifest, which will lead to the fact that R.java will be
> > generated in two different places. Which will make my references to R
> > from my android code not resolving.
>
> Make your reusable code take resource IDs as parameters to their APIs.
>
> Look at Android itself: it is reusable, yet it does not have the problems
> you describe. Why? Because resource IDs are passed in as parameters (e.g.,
> setImageResource() does not assume the resource; it takes the resource ID
> as a parameter).
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com
> _The Busy Coder's Guide to Android Development_ Version 2.0 Available!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to