开发者

setContentView not working

i have file name TabGroupActivity.java which contains the below function as

  public void startChildActivity(String Id, Intent intent) {     
          try{
              Window window = getLocalActivityManager().startActivity(Id,intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
              if (window != null) {
                  System.out.println("Start Account page.....");
                  Global.mIdList.add(Id);
                  setContentView(window.getDecorView());

              }   
            } catch(Exception ex){ 
                System.out.println("Start Account page....."+ex.getMessage());
          }

      }

This is called from various files, when this is called as below it works.

    file name e.java 

    Global.eInsObject = this;
            Global.eIns = new Intent(this,myAccount.class);
            startChildActivity("myAccount",Global.eIns);

This works perfectly fine but when i call the below was it doesnt give any error but also doesnt show new view or anything,.

file name :- Home.java

System.out.println("Global.eInsObject is" +Global.eInsObject);
                                    System.out.println("Global.eIns is" +Global.eIns);

                                    TabGroupActivity parentActivityE = (TabGr开发者_如何学CoupActivity) Global.eInsObject;
                                    //System.out.println("parentActivityE is "+parentActivityE);
                                    parentActivityE.startChildActivity("myAccount", Global.eIns);


Does the http://developer.android.com/resources/tutorials/views/hello-tabwidget.html not address your requirements?

If you want to do anything else (I can only think of one requirement not met by the tagwidget: Tab-switching between views instead of activities), I'd suggest that you take a look at the ViewFlipper. The ViewFlipper should let you meet all other requirements.

I still don't completely understand why you had to "setContentView(window.getDecorView())".

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜