Note that there are some explanatory texts on larger screens.

plurals
  1. POMy activity is FORCE CLOSING as soon as i run.. I have used a ListActivity and created a custom adapter
    text
    copied!<p>This is my .java file:</p> <pre><code> public class List1 extends ListActivity { /** Called when the activity is first created. */ ListView lv1; private ArrayList&lt;Tree&gt; m_orders; private TreeAdapter m_adapter; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); getItems(); this.m_adapter = new TreeAdapter(this, R.layout.row, m_orders); setListAdapter(this.m_adapter); } public void getItems() { m_orders=new ArrayList&lt;Tree&gt;(); Tree t=new Tree(); t.setItemName("Document"); m_orders.add(t); t.setItemName("Address Book"); m_orders.add(t); } } class TreeAdapter extends ArrayAdapter&lt;Tree&gt; { private ArrayList&lt;Tree&gt; it; public TreeAdapter(Context context, int textViewResourceId,ArrayList&lt;Tree&gt; items) { super(context, textViewResourceId, items); this.it=items; } @Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.row, null); } Tree o = it.get(position); if (o != null) { TextView tt = (TextView) v.findViewById(R.id.toptext); Button btn = (Button)v.findViewById(R.id.theButton); if (tt != null) { tt.setText("Name is " + o.getItemName()); } if(btn!=null){ btn.setTag(o); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Tree o = (Tree)v.getTag(); String message = o.getItemName() + " clicked"; Toast.makeText(getContext(), message, Toast.LENGTH_LONG).show(); } }); } } return v; } } </code></pre> <p><strong>In row.xml i have</strong><br> LinearLayout<br> -> Checkbox<br> -> Button<br> -> TextView </p> <p><strong>In main.xml i did</strong><br> LinearLayout<br> -> ListView<br> -> TextView </p> <p><strong>I am getting this in my LOGCAT:</strong><br> FATAL EXCEPTION:<br> UNABLE TO START ACTIVITY COMPONENT.INFO </p>
 

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