I have two android application projects in my workspace, Testobject and MyAndroidApplication.
I would like to use one of them, Testobject, as a base for the new one. For that purpose, I have setting up Testobject as a library (Properties - Android - checked Checkbox Is Library). In MyAndroidApplication I have add the lib Testobject (Properties - Android - Add...).
Now I can use all classes and ressources from Testobject:
I have used an XML from Testobject and changed for example the ImageView.
/** called when the activity is first created */
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView stImageView = (ImageView) findViewById(R.id.imageview_ov_remote);
stImageView.setImageResource(R.drawable.car_launcher);
}
While clicking the ImageView, a new activity get started.
Intent intent = new Intent(this, TestKlasse1.class);
startActivity(intent);
The started activity is in the project Testobject.
How can I change a TextView from TestKlasse1 in the project MyAndroidApplication?
//cutout from Testklasse1 in Testobject
TextView testString;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_testklasse_eins);
testString = (TextView) findViewById(R.id.testKlasse1TextView);
}
I won't change the content in TestKlasse1, because I want to use this class for different apps. For example for a supermarket app or an automobile manufacturer app. I don't want only to change the ic_launcher. Multiple Applications with different names
How can I change for example the TextView, though the class is in another project?