Note that there are some explanatory texts on larger screens.

plurals
  1. POListActivity CustomAdapter error, onListItemClick never works
    primarykey
    data
    text
    <p>Below you can see the code, i implemented a simple adapter for my listview. But i can not get in to onListItemClick. can anyone has suggestions ? </p> <p>actually it displays the list normally but i am not able to get onitemclick events . thanks in advance.</p> <pre><code> public class MyListActivity extends ListActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ArrayList&lt;Frame&gt; results = WebOperations .loadList_Frame(); myAdapter = new MyListAdapter(MyListActivity.this); myAdapter.internalList = results; setListAdapter(myAdapter); myAdapter.notifyDataSetChanged(); }; @Override protected void onListItemClick(ListView l, View v, int position, long id) { String item = (String) getListAdapter().getItem(position); Toast.makeText(this, item + " please show toast!!!!!!!!!", Toast.LENGTH_LONG).show(); } public static class MyListAdapter extends BaseAdapter { public ArrayList&lt;Frame&gt; internalList; public LayoutInflater mInflater; public int pageCount = 0; public MyListAdapter(Context context) { mInflater = LayoutInflater.from(context); } public int getCount() { if (internalList == null) return 0; return internalList.size(); } public Object getItem(int position) { if (internalList == null || internalList.size() &lt; position) return null; return internalList.get(position); } public long getItemId(int position) { if (internalList == null || internalList.size() &lt; position) return 0; return internalList.get(position).getId(); } public View getView(int position, View arg1, ViewGroup parent) { View v = arg1; if ((v == null) || (v.getTag() == null)) { v = mInflater.inflate(R.layout.entryrow, null); try { String gunlukText = String.format(" %s ", internalList.get(position).getKeyText().toString()); TextView entry = (TextView) v .findViewById(R.id.textViewEntryText); entry.setText((CharSequence) gunlukText); } catch (Exception e) { Log.d("aaaaaaaaaaaaaaaaaaa", "errorrrrrrrrrrr"); } } return v; } } } </code></pre> <p>EDIT 1 : I am adding entry_row layout xml file below. </p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;TextView android:id="@+id/textViewEntryText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:inputType="textMultiLine" android:padding="5dp" android:paddingLeft="10dp" android:text="@string/Ana_Sayfa" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;/LinearLayout&gt; </code></pre>
    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. 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