Getting map to reappear after switching views

1982
1
04-26-2012 07:10 AM
CoreyStokes
New Contributor
Hi All,

I am trying to get the map to reappear after switching views. The basic setup is the user presses a button that switches to a table layout. Afterwards, if the back button is pressed, the view is switched back to the main layout. But, when this switch occurs the map is blank. Any suggestions on this issue?

setContentView(R.layout.table);



/*Create table code*/






//Inflate table layout
View view = LayoutInflater.from(MDHealthMobileActivity.this).inflate( R.layout.table,null);

//Back button
backBtn = (Button) findViewById(R.id.backBtn);
         backBtn.setOnClickListener(new OnClickListener () {
          
          public void onClick(View v) {
           
           setContentView(R.layout.main);       
           
         });


-Corey
0 Kudos
1 Reply
SimonKlein
Occasional Contributor
Hey

you should create new activity for your tableview because after you change the view to the table layout your map loses the reference to the mainlayout I think. Honestly, I have never seen something like this.
Better stick to the "normal" way. An activity for your map then start another activity with your tablelayout. Changing the contentview like this seems a little drastic to me.
0 Kudos