diff --git a/core/java/android/app/ListActivity.java b/core/java/android/app/ListActivity.java index 4b4cc050dcbeb..84a57b526a6d9 100644 --- a/core/java/android/app/ListActivity.java +++ b/core/java/android/app/ListActivity.java @@ -51,31 +51,31 @@ import android.widget.ListView; * The following code demonstrates an (ugly) custom screen layout. It has a list * with a green background, and an alternate red "no data" message. *

- * + * *
  * <?xml version="1.0" encoding="utf-8"?>
  * <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  *         android:orientation="vertical"
- *         android:layout_width="match_parent" 
+ *         android:layout_width="match_parent"
  *         android:layout_height="match_parent"
  *         android:paddingLeft="8dp"
  *         android:paddingRight="8dp">
- * 
+ *
  *     <ListView android:id="@id/android:list"
- *               android:layout_width="match_parent" 
+ *               android:layout_width="match_parent"
  *               android:layout_height="match_parent"
  *               android:background="#00FF00"
  *               android:layout_weight="1"
  *               android:drawSelectorOnTop="false"/>
- * 
+ *
  *     <TextView id="@id/android:empty"
- *               android:layout_width="match_parent" 
+ *               android:layout_width="match_parent"
  *               android:layout_height="match_parent"
  *               android:background="#FF0000"
  *               android:text="No data"/>
  * </LinearLayout>
  * 
- * + * *

* Row Layout *

@@ -96,27 +96,27 @@ import android.widget.ListView; * source for the resource two_line_list_item, which displays two data * fields,one above the other, for each list row. *

- * + * *
  * <?xml version="1.0" encoding="utf-8"?>
  * <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  *     android:layout_width="match_parent"
  *     android:layout_height="wrap_content"
  *     android:orientation="vertical">
- * 
+ *
  *     <TextView android:id="@+id/text1"
  *         android:textSize="16sp"
  *         android:textStyle="bold"
  *         android:layout_width="match_parent"
  *         android:layout_height="wrap_content"/>
- * 
+ *
  *     <TextView android:id="@+id/text2"
  *         android:textSize="16sp"
  *         android:layout_width="match_parent"
  *         android:layout_height="wrap_content"/>
  * </LinearLayout>
  * 
- * + * *

* You must identify the data bound to each TextView object in this layout. The * syntax for this is discussed in the next section. @@ -137,40 +137,40 @@ import android.widget.ListView; * Contacts provider for all contacts, then binding the Name and Company fields * to a two line row layout in the activity's ListView. *

- * + * *
  * public class MyListAdapter extends ListActivity {
- * 
+ *
  *     @Override
  *     protected void onCreate(Bundle savedInstanceState){
  *         super.onCreate(savedInstanceState);
- * 
+ *
  *         // We'll define a custom screen layout here (the one shown above), but
  *         // typically, you could just use the standard ListActivity layout.
  *         setContentView(R.layout.custom_list_activity_view);
- * 
+ *
  *         // Query for all people contacts using the {@link android.provider.Contacts.People} convenience class.
  *         // Put a managed wrapper around the retrieved cursor so we don't have to worry about
  *         // requerying or closing it as the activity changes state.
  *         mCursor = this.getContentResolver().query(People.CONTENT_URI, null, null, null, null);
  *         startManagingCursor(mCursor);
- * 
- *         // Now create a new list adapter bound to the cursor. 
+ *
+ *         // Now create a new list adapter bound to the cursor.
  *         // SimpleListAdapter is designed for binding to a Cursor.
  *         ListAdapter adapter = new SimpleCursorAdapter(
  *                 this, // Context.
- *                 android.R.layout.two_line_list_item,  // Specify the row template to use (here, two columns bound to the two retrieved cursor 
+ *                 android.R.layout.two_line_list_item,  // Specify the row template to use (here, two columns bound to the two retrieved cursor
  * rows).
  *                 mCursor,                                              // Pass in the cursor to bind to.
  *                 new String[] {People.NAME, People.COMPANY},           // Array of cursor columns to bind to.
  *                 new int[] {android.R.id.text1, android.R.id.text2});  // Parallel array of which template objects to bind to those columns.
- * 
+ *
  *         // Bind to our new adapter.
  *         setListAdapter(adapter);
  *     }
  * }
  * 
- * + * * @see #setListAdapter * @see android.widget.ListView */ @@ -194,13 +194,13 @@ public class ListActivity extends Activity { mList.focusableViewAvailable(mList); } }; - + /** * This method will be called when an item in the list is selected. * Subclasses should override. Subclasses can call * getListView().getItemAtPosition(position) if they need to access the * data associated with the selected item. - * + * * @param l The ListView where the click happened * @param v The view that was clicked within the ListView * @param position The position of the view in the list @@ -208,11 +208,11 @@ public class ListActivity extends Activity { */ protected void onListItemClick(ListView l, View v, int position, long id) { } - + /** * Ensures the list view has been created before Activity restores all * of the view states. - * + * *@see Activity#onRestoreInstanceState(Bundle) */ @Override @@ -221,10 +221,19 @@ public class ListActivity extends Activity { super.onRestoreInstanceState(state); } + /** + * @see Activity#onDestroy() + */ + @Override + protected void onDestroy() { + mHandler.removeCallbacks(mRequestFocus); + super.onDestroy(); + } + /** * Updates the screen state (current list and other views) when the * content changes. - * + * * @see Activity#onContentChanged() */ @Override @@ -262,7 +271,7 @@ public class ListActivity extends Activity { /** * Set the currently selected list item to the specified * position with the adapter's data - * + * * @param position */ public void setSelection(int position) { @@ -290,7 +299,7 @@ public class ListActivity extends Activity { ensureList(); return mList; } - + /** * Get the ListAdapter associated with this activity's ListView. */ @@ -303,7 +312,7 @@ public class ListActivity extends Activity { return; } setContentView(com.android.internal.R.layout.list_content); - + } private AdapterView.OnItemClickListener mOnClickListener = new AdapterView.OnItemClickListener() { @@ -313,4 +322,3 @@ public class ListActivity extends Activity { } }; } -