Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are very much over-complicating things</p> <p>in your main DiarySchedule activity you should implement OnItemClickListener. Override the onItemClick method for the listener and perform your actions in there. Set your listener by calling getListView().setOnItemClickListener(this); in your onCreate method..</p> <p>Ex. </p> <pre><code>public class DiarySchedule extends ListActivity implements OnItemClickListener { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.diary_schedule); datasource = new DiaryDataSource(this); datasource.open(); List&lt;DiaryEntry&gt; values = datasource.getAllDiaryEntries(); DiaryScheduleAdapter adapter = new DiaryScheduleAdapter(this,values); setListAdapter(adapter); registerForContextMenu(getListView()); getListView().setOnItemClickListener(this); //this sets the listener } @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View v, int position, long arg3) { String title = ((TextView)v.findViewById(R.id.scheduleListTitle)).getText().toString(); String date = ((TextView)v.findViewById(R.id.scheduleListDate)).getText().toString(); date = GetInfoConvertToDate(date); String time = ((TextView)v.findViewById(R.id.scheduleListTime)).getText().toString(); Intent descIntent = new Intent(DiarySchedule.this, DiaryDetailed.class); descIntent.putExtra("title", title); descIntent.putExtra("date", date); descIntent.putExtra("time", time); startActivity(descIntent); } } </code></pre> <p>You can then remove the call to v.setOnClickListener(new OnItemClickListener(position)); in your adapter and the class that you created to handle clicks.</p> <p>When in the onItemClick method and you are trying to use "findViewById" you should be using "v.findViewById(id);" since you are searching within the View "v". </p> <p>This is likely your problem to begin with. (and you can fix it as such) but i'd recommend doing it the "proper" way as I describe above instead of having individual handlers for each item in your listview</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. This table or related slice is empty.
    1. 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