开发者

ActivityGroup is Deprecated

开发者 https://www.devze.com 2023-04-08 18:00 出处:网络
I am making android application containing three tabs.. On third tab there is login screen.. when i click on login button ...i want to replace the activity with activity containing list view and log

I am making android application containing three tabs.. On third tab there is login screen..

when i click on login button ...i want to replace the activity with activity containing list view and logout button....

Previously i was using Activity Group to replace the activity..But activity Group is now deprecated..

Now how can i replace the activity under third tab??

I am using these code

Intent intent = new Intent(MyApp.this, LoginPage.class);

                    replaceContentVieww("activity4", intent);



  public void replaceContentVieww(String id, Intent newIntent) {
                    // TODO Auto-generated method stub


View view = getLocalActivityManager().startActivity(id,newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView(); 
    开发者_运维问答                        setContentView(view);


                    }

There is link from which i came to know this class has been deprecated.


you should use Fragment and FragmentManager in the Compatibility Package

http://developer.android.com/sdk/compatibility-library.html

download it using the ADT, then go to the samples here extras/android/compatibility/v4/samples/


Now how can i replace the activity under third tab??

You can define tab contents as existing children of the FrameLayout (via the setContent() that takes a widget ID) or as a dynamically-created View (via the setContent() that takes a TabContentFactory).

0

精彩评论

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

关注公众号