The answer to this question may be really obvious, but it gives me a headache. I have a simple LinearLayout with one ListView in it. I am doing this: onCreate
public void onCreate(Bundle b) { super.onCreate(b); setContentView(R.layout.friends); ListView listView = (ListView) findViewById(R.id.friend_list); listAdapter = new CheckinListAdapter(checkins, listView, R.layout.checkin_list_item); listView.setAdapter(listAdapter); if (getLastNonConfigurationInstance() != null) { FriendsActivity last = (FriendsActivity) getLastNonConfigurationInstance(); this.checkins.addAll(last.checkins); this.sort = last.sort; } else { refresh(); } registerForContextMenu(listView); }
But for some reason, onCreateContextMenu never called! So I did some research, and since I am loading the list after registration, it may not be registering it correctly. If I go to my ListAdapter and do registerForContextMenu , it will appear. But the keyboard does not behave correctly. Therefore, I am now confused by what might be a mistake, because it seems to me that I am not interested in registering each child element. All the examples I found on the Internet use the ArrayAdapter .: (
Any suggestions?
Edit
Here in more detail, in case I do not see something:
My xml file
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <Button android:text="@string/check_in" android:layout_width="fill_parent" android:layout_height="wrap_content" android:onClick="onCheckInClicked"/> <ListView android:id="@+id/friend_list" android:layout_width="fill_parent" android:layout_height="fill_parent"/> </LinearLayout>
Xml list item:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingTop="5dip" android:paddingBottom="5dip"> <ImageView android:id="@+id/user_photo" android:layout_width="40dip" android:layout_height="40dip" android:scaleType="centerCrop"/> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:layout_marginLeft="8dip"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <Button android:id="@+id/user" style="@style/TextButton"/> <TextView android:text="@string/at" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <Button android:id="@+id/venue" android:singleLine="true" android:ellipsize="end" style="@style/TextButton"/> </LinearLayout> <TextView android:id="@+id/venue_address" style="@style/GreyLarge"/> <LinearLayout android:id="@+id/checkin_detail" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="6dip" android:layout_marginBottom="6dip"> <ImageView android:id="@+id/checkin_image" android:layout_width="70dip" android:layout_height="60dip" android:layout_marginRight="8dip" android:scaleType="centerCrop"/> <TextView android:id="@+id/checkin_shout" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </LinearLayout> <TextView android:id="@+id/elapsedTime" style="@style/GreySmall"/> </LinearLayout> </LinearLayout>
source share