Reputation: 1
I have two classes. FirstActivity and SecondActivity. In the FirstActivity I have something like this:
Intent intent = new Intent(this, Color.class);
intent.putExtra("keyName","#FFFFFF");
startActivity(intent);
In the SecondActivity, I want to have something like this:
String data = getIntent().getExtras().getString("keyName");
The problem here is that I already extended "View" in my SecondActivity so my code above will not work in SecondActivity as I need to extend "Activity" to make intents work. How do I solve this? I guess it is by making another class extending Activity, but if I do that, what should I do to send things from my ThirdActivity to my SecondActivity?
Upvotes: 0
Views: 1332
Reputation: 414
You can simply use this:
Intent intent = new Intent(context,MainActivity.class)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
Upvotes: 1