I have searched for how to start and Activity from another Activity and I keep finding
Intent intent = new Intent(this, ExampleClass.class); startActivity(intent);
But I want to start from an instantiated activity. I have a container with many activities and when the user selects from my UI I wish to show a particular one.
So, for example.
class MyExample extends Activity {
MyExample mx = new MyExample();
So how do I now start this Activity.
What I would like is
Intent intent = new Intent(this, mx);
startActivity(intent);
Any help greatly appreciated from a reasonably experienced Java developer but new to Android.
This is possible, though I do not understand yet why you want to do this.
Make sure the Activity you want to startis well declared in your manifest :
<activity android:name=".com.example.MyExample" ... />
Then you can call in you current Activity :
Intent myIntent = new Intent();
myIntent.setComponent(new ComponentName("com.example", "com.example.MyExample"));
startActivity(myIntent);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With