开发者

Android dynamic tab and multiple instance of an activity problem

开发者 https://www.devze.com 2023-03-22 06:27 出处:网络
I am making a chat applic开发者_JS百科ation. Where i am using tabhost. I have a activity A to show the frndlist and activity B for chat window. Now when an entry in the frndlist clicked a tabwindow op

I am making a chat applic开发者_JS百科ation. Where i am using tabhost. I have a activity A to show the frndlist and activity B for chat window. Now when an entry in the frndlist clicked a tabwindow opens where i add tab dynamically using the intent of activity B. Now if there are more than one tab when i nevigate through those tab nothing get called(oncreate, onpause,onresume) and the containt remain same for all tabs. Only one instance of activity B is created.

Is there any idea to create chat application with tab(like yahoo mail chat).

thanks in advance Please help Rawcoder


Create this class too in your TabActivity

class PreExistingViewFactory implements TabContentFactory {
    private final View preExisting;

    protected PreExistingViewFactory(View view) {
        preExisting = view;
    }

    public View createTabContent(String tag) {
        return preExisting;
    }
}

This works for me.

0

精彩评论

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

关注公众号