public class ListPage extends ListActivity
{
ListView months;
ArrayAdapter my;
String[] monthlist = {"jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sept", "oct", "nov", "dec"};
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.list_page);
months = (ListView)findViewById(R.id.list);
my = new ArrayAdapter(this,android.R.layout.simple_list_item_1,monthlist);
months.setAdapter(my);
}
}
この ListActivity を別のアクティビティから起動しようとしていますが、「04-30 08:30:45.234:
E/AndroidRuntime(2010): java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.example.listinflator_demo/com.example.listinflator_demo.
ListPage}: java.lang.RuntimeException: Your content must have a ListView
whose id attribute is 'android.R.id.list'"
に変更extends ListActivity
するextends Activity
と、コードは正常に機能します。を使用して動作させるにはどうすればよいですextends ListActivity
か??