Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to inflate another xml on clicking a button
    primarykey
    data
    text
    <p>I have one <code>Activity</code> in that there are no <code>Button</code>s but I have coded it in such a way that another <code>Activity</code> comes, now in this second <code>Activity</code> there are three <code>Button</code>s, on which when I click all inflating different respective activities. In this second <code>Activity</code> there I have added one more <code>Button</code>, on clicking this 4th <code>Button</code> I don't want another <code>Activity</code> to come in foreground instead i just want another layout to be inflated(I don't wanna change the <code>Activity</code>) In that layout(which i need to inflate) I have a <code>ListView</code> which has a list of certain sites, when this layout is inflated the list of sites should be shown and as i click on there sites its should take me to that webpage.</p> <p><strong>PROBLEM 1:</strong> How to inflate just the <code>xml</code> on click of the 4th <code>Button</code> without changing the <code>Activity</code>.</p> <p><strong>PROBLEM 2:</strong> When the <code>xml</code> is inflated and if I click on <code>BackButton</code> the <code>Activity</code> containing all the 4 <code>Button</code>s should be displayed.</p> <p>Here is the code that I'm using to inflate another <code>xml</code>:</p> <pre><code>fourthButton.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { callingMore(); } }); private void callingMore() { LayoutInflater inflater = getLayoutInflater(); View layout = inflater.inflate(R.layout.web_site_list_xml, (ViewGroup)findViewById(R.id.site_list)); } </code></pre> <p>BUT this code gives a force close and no <code>xml</code> is being inflated and if I use <code>setContentView( R.layout.web_site_list_xml)</code> inside <code>callingMore()</code> method the <code>xml</code> is inflated but that <code>xml</code> doesn't show anything and then if I hit <code>BackButton</code>, the <code>Activity</code> that has all 4 <code>Button</code>s isn't shown.</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.
 

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