Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are thinking of this wrong. When you call <code>setContentView()</code> the second time, it is not setting that <code>layout</code> as a child of <code>xyz_parent_layout.xml</code>. It is setting the content for the whole screen as <code>yzx_image_layout</code>.</p> <p>What it sounds like you want to do is to inflate <code>yzx_image_layout.xml</code> and add it to your <code>xyz_parent_layout</code> in the <code>showMeTheImage()</code> function. Then when you call <code>removeView()</code> on your parent <code>layout</code> it will remove that child.</p> <p>I don't know exactly what you are doing but another option, posssibly easier, is to put your image layout in a separate <code>Activity</code> then in your function you start that <code>Activity</code>. This way, when you press the back button it will remove that <code>Activity</code> from the stack and return to your first <code>Activity</code> where you have your <code>xyz_parent_layout</code>.</p> <p>It doesn't sound like you want that to be a full-screen <code>Activity</code> so you can add the following line to the appropriate <code>&lt;activity&gt;</code> tag in your <code>manifest.xml</code></p> <pre><code>android:theme="@android:style/Theme.Dialog" </code></pre> <p>to give it a <code>Dialog</code> appearance.</p> <p><strong>Edit</strong></p> <pre><code>setContentView(R.layout.parent); // assuming you have a layout file named parent.xml parent = (LinearLayout)mInflater.inflate(R.layout.parent, null); button = (Button)parent.findViewById(R.id.button_dosomething); startOdometerPic.setOnClickListener(new View.OnClickListener() { public void onClick(View buttonView) { showImageView(); } }); </code></pre> <p>And remove</p> <pre><code>context.setContentView(parent); </code></pre> <p>from your <code>showImage()</code> function.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload