+ Reply to Thread
Results 1 to 2 of 2

Thread: Getting map to reappear after switching views

  1. #1
    Corey Stokes
    Join Date
    Oct 2011
    Posts
    6
    Points
    0
    Answers Provided
    0


    0

    Default Getting map to reappear after switching views

    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?

    Code:
    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

  2. #2
    Simon Klein
    Join Date
    Mar 2011
    Posts
    85
    Points
    21
    Answers Provided
    4


    0

    Default Re: Getting map to reappear after switching views

    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.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts