开发者

change activity view while moving back from called activity when using tabs

开发者 https://www.devze.com 2023-03-17 13:08 出处:网络
i am using tabs.In a single tab i have several activity which is called one after one.In this i am calling getdecorview() when starting new activity and storing the view in arraylist and while moving

i am using tabs.In a single tab i have several activity which is called one after one.In this i am calling getdecorview() when starting new activity and storing the view in arraylist and while moving back and I am getting the view from arrayl开发者_运维技巧ist and setting it as content view.Now my peroblem is I want to set textview after moving back from called activity.For example i want to show it diagramatically as ---activity one---- --->called --activity two-- (get some value here from user) ------->now move back to -->activity one(here set value which got from activity two)

    how i can set the value which i got from second activity in activity one while using tabs? 
    thank you


In this case, what you need is to launch the second activity via Activity.startActivityForResult()

The first activity must overrides the method

onActivityResult(int requestCode, int resultCode, Intent data)

and the second activity must be launched as

Intent intent = new Intent(this, SecondActivity.class);
intent.putExtra("sampleData", "This is Sample Data");
startActivityForResult(intent, 1);

More info here:


use startActivityForResult to call activity B.

check these docs and examples 1. http://developer.android.com/reference/android/app/Activity.html 2. http://rahulonblog.blogspot.com/2010/05/android-startactivityforresult-example.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号