Hi!
I have a problem with using setVisibility(View.GONE) and VISIBLE. I have a listview where I store stuff and when a list-item is clicked I use listView.setVisibility(View.GONE) and inflate a new layout to this area. In this new layout I keep information about the chosen list-item together with three buttons. The button I'm trying to get to work should take the user back to the list when clicked.

When the button is clicked I set the inflated layout to GONE and the listview to VISIBLE. This works great, and when I click an item in the list a second time it works great as well.

The problem is when I click the back-button a second time. What happens is that the listview turns visible, as it should do. But the inflated view stays visible and I have no idea why because it works the first time. I'm thinking that I might not reach this inflated view the second time because I may be outside the inflated view, but I'm not sure...

Here is my code for the "on item click" in the listview:
Code:
listView1.setOnItemClickListener(new OnItemClickListener() {

		@Override
		public void onItemClick(AdapterView<?> parent, View view,
	            int position, long id) {
			// TODO Auto-generated method stub
			
				//Store which recipe that was clicked
				String recipe = listView1.getItemAtPosition(position).toString();
            	
            	//Search the database for the recipe and pick out the 
            	//different values it contains.
            	List<String> stuffList = datasource.getAllStuff(recipe);
            	String category = stuffList.get(0).toString();
            	String comment = stuffList.get(1).toString();
            	float numStars = Float.parseFloat(stuffList.get(2));
            	
            	//Inflate a new layout to show the recipe details in
            	ViewGroup ******* = (ViewGroup) findViewById(R.id.tab2);
            	view = LayoutInflater.from(getBaseContext()).inflate(R.layout.activity_display_recipe,
                        *******,false); //null);
            	
            	//Hide the previous layout (the list of recipes)
            	listView1.setVisibility(View.GONE);
          	  	view.setVisibility(View.VISIBLE);
            	
            	//Set the values
            	TextView tV1 = (TextView) view.findViewById(R.id.tV1);
            	TextView tV2 = (TextView) view.findViewById(R.id.tV2);
            	TextView tV3 = (TextView) view.findViewById(R.id.tV3);
            	RatingBar rB1 = (RatingBar) view.findViewById(R.id.rB1);
            	tV1.setText(recipe);
            	tV2.setText(category);
            	tV3.setText(comment);
            	rB1.setRating(numStars);
            	
            	//Add the inflated view to the tab
                *******.addView(view);
		}
      });
And here is my code for the buttons onClick function:
Code:
public void backToList(View button)
  {
	  final ListView listView1 = (ListView) findViewById(R.id.listView1);
	  final LinearLayout linLay2 = (LinearLayout) findViewById(R.id.linLay2);
	  linLay2.setVisibility(View.GONE);
	  listView1.setVisibility(View.VISIBLE);
  }
Please let me know if you need more of the code.