startActivityForResult not working TabGroupActivity in android
-
09-06-2021 - |
質問
I have used Experience - Multiple Android Activities in a TabActivity to implement tab.
I have the following condition.
MainActivity extends TabActivity (Tab1,Tab2,Tab3)
TabGroup1Activity extends TabGroupActivity (class from above url)
In TabGroup1Activity:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
startChildActivity("MyActivity", new Intent(this,MyActivity.class));
}
And in MyActivity.java class i used
PayPalPayment payment = SimplePayment();
Intent checkoutIntent = PayPal.getInstance().checkout(payment,
MyActivity.this,new ResultDelegate());
startActivityForResult(checkoutIntent, request);
But it doesnot execute onActivityResult method.
When i run this code in another project without tabs and activity group, it goes to onActivityResult, works fine.
what should i do to make it work here ?
Help Please !!
解決
Your onActivityResult
is called on the ActivityGroup
and not on the subActivity
of your tabgroupActivity
.
So override the method onActivityResult
, and then create an abstract method
on the mother class of your SubActivities
( on the TabActivityGroup
i think ), and override it on each subActivity .
他のヒント
Intent intent = new Intent(v.getContext(),PlayStation.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
AppplicationData app1 = UrlSet.get(i);
intent.putExtra("Url", "" + app1.getUrlLink());
intent.putExtra("URLName", app1.getUrlName());
intent.putExtra("PrevActivity", "UserUrl");
View view = getLocalActivityManager()
.startActivity("PlayStaion", intent)
.getDecorView();
setContentView(view);