> 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);
>
> }
>
> }
Option #1: Don't use layout resources. Instantiate your views using Java.
Option #2: Create reusable Views for your activities that take the
resource ID of their respective layouts as a parameter. Each view would
navigate its contents without resource IDs (e.g., iterate over children)
to find your widgets.
Option #3: Augment (or wrap) your Ant build scripts to make N copies of
your application from one master source, using text search-and-replace
(sed/awk if you're a true geek, Ruby if you're like me and don't grok
sed/awk) to replace necessary strings in the copies with revised ones for
that particular copy.
I'm sure there are any number of other possibilities.
--
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
-~----------~----~----~----~------~----~------~--~---