D
Deleted User
Guest
I created an Activity that extends ListActivity
My layout for this Activity is as follows
I followed a tutorial to do this. As you can see, my ListView's id in the xml is @+id/android:list which seems to be a generic id.
When I am in my Activity's OnCreate handler, I cannot access this ListView object.
How can I do this? If I edit the layout xml and give it my own custom id, the application crashes when the following line is called in the Activity OnCreate method:
Is there something like this.????????? that can pull the view? I want to create a context menu for my list items, but I need this in a ListView object
Code:
public class ActivityInbox extends ListActivity implements OnClickListener, StateModelListener {
Code:
<?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"
>
<ListView
android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
<TextView
android:id="@+id/android:empty"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="@string/inbox_no_items"
/>
</LinearLayout>
I followed a tutorial to do this. As you can see, my ListView's id in the xml is @+id/android:list which seems to be a generic id.
When I am in my Activity's OnCreate handler, I cannot access this ListView object.
Code:
ListView lw = (ListView) findViewById(R.id.???????);
How can I do this? If I edit the layout xml and give it my own custom id, the application crashes when the following line is called in the Activity OnCreate method:
Code:
setContentView(R.layout.layout_inbox);
Is there something like this.????????? that can pull the view? I want to create a context menu for my list items, but I need this in a ListView object