开发者

multiple instance of same activity

hello I am new to android and I need your help. I have a home activity and one friend activity. From home I am creating friend activity. how can I have more than one开发者_StackOverflow中文版 instance of friend , save their state and switch between them. please help me.


ActivityGroup --> getLocalActivityManager().startActivity(id, intent);


check here How activiity an task handaled in android

i think dont create new instances instead save the state in Sharedpreferences and then use that saved state while you want to change.

also another way in your home activity call this method

startActivityforResult(intent,code);

and every time create new instance of friend class and while coming back to home just pass the

setResult(code);

which can be checked at call back method of Home activity.

onActivityResult(); 
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜