Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid context menu no longer appearing in emulator
    text
    copied!<p>I'm building an Android app that uses a context menu on a list from a database. I had it all working fine, moved on to building a section of the app that uses maps, and now (while I've switched to the level 10 android google emulator) I have had two issues spring up. The first was fixed quickly enough, but my context menus no longer appear. I don't know if it's something to do with the change in emulator, but here's my code:</p> <p>In onCreate we have:</p> <pre><code>super.onCreate(savedInstanceState); datasource = new DiaryDataSource(this); datasource.open(); List&lt;DiaryEntry&gt; values = datasource.getAllDiaryEntries(); DiaryScheduleAdapter adapter = new DiaryScheduleAdapter(this,values); setListAdapter(adapter); registerForContextMenu(getListView()); </code></pre> <p>Then in my class that extends ArrayAdapter we have:</p> <pre><code>@Override public View getView(int position, View convertView, ViewGroup parent) { DiaryEntry diaryEntry = getItem(position); View v = convertView; if ( v == null ) { v = li.inflate(R.layout.diary_schedule, null); } **** TextViews etc **** v.setOnClickListener(new OnItemClickListener(position)); return v; </code></pre> <p>And then the onCreateContextMenu:</p> <pre><code>@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.diary_context_menu, menu); } </code></pre> <p>Also, for the normal press click listener I use this:</p> <pre><code>private class OnItemClickListener implements OnClickListener { private int mPosition; OnItemClickListener(int position) { mPosition = position; } @Override public void onClick(View v) { **** various bits of code to set up intent **** startActivity(descIntent); } } </code></pre> <p>And then the onContextItemSelected method below that, but I don't get that far. Again, I'm sure I made no changes to the code, but the long click now does nothing. Any ideas?</p> <p>Thanks</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