Hi,

 

I was wondering whether anybody has tried calling setContentView() more than 
once in method onCreate() when creating an Activity. It seems only the last 
view is displayed. Or am I missing something here ? 

 

Say we have an Activity:

 

public class SampleActivyt extends Activity {

 

    @Override  

     public void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
         setContentView(R.layout.layout1);

 

         // DO SOMETHING HERE .... and when it is done change the view

 

         setContentView(R.layout.layout2);

 

   }

}

 

 

You can think of it as you have a "loading" screen while a computation is being 
done and once it's finished the view needs to be changed.

 

Cheers,

 

Emre


PS. I tried moving "setContentView(R.layout.layout2)" inside the onStart() 
method, only to find that this time the second view never gets displayed so I 
am stuck with the first one.

_________________________________________________________________
Send and receive email from all of your webmail accounts.
http://go.microsoft.com/?linkid=9671356
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to