I need to change Activity to ListActivity. But I can't start my project... do ı need change manifest.xml for it??
Or how can I change screen from Activity to ListActivity? Is there any difference to startActivity(new Intent(this, list.class))
?
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): java.lang.RuntimeException: Unable to start activity ComponentInfo{spexco.hus.cepvizyon/spexco.hus.cepvizyon.CepVizyon}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at android.os.Handler.dispatchMessage(Handler.java:99)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at android.os.Looper.loop(Looper.java:123)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at android.app.ActivityThread.main(ActivityThread.java:4363)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at java.lang.reflect.Method.invokeNative(Native Method)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at java.lang.reflect.Method.invoke(Method.java:521)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at dalvik.system.NativeStart.main(Native Method)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at android.app.ListActivity.onContentChanged(ListActivity.java:236)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:201)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at android.app.Activity.setContentView(Activity.java:1622)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at spexco.hus.cepvizyon.CepVizyon.onCreate(CepVizyon.java:21)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): ... 11 more
10-05 17:34:55.432: ERROR/PowerManagerService(129): setPowerState SystemProperties.get siBefornormal
10-05 17:35:01.872: ERROR/PowerManagerService(129): setPowerState SystemProperties.get siBefornormal
public class CepVizyon extends ListActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
ListView list=(ListView) findViewById(R.id.list);
ImageButton b1 = (ImageButton) findViewById(R.id.menu_mycameras);
ImageButton b2 = (ImageButton) findViewById(R.id.menu_aboutus);
ImageButton b3 = (ImageButton) findViewById(R.id.menu_help);
b1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(CepVizyon.this, CameraSelectScreen.class);
startActivity(intent);
// TODO Auto-generated method stub
}
});
b2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(CepVizyon.this,MainActivity.class);
startActivity(intent);
// TODO Auto-generated method stub
}
});
b3.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
}
});
}
}
this is my class..
And This is my main.xml I dont use list there, ı put ıt for error stack. but nothıng change.
<LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical" android:layout_weight="3">
<ImageButton android:layout_weight="1" android:id="@+id/menu_mycameras"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:background="@drawable/menu_cameras">
</ImageButton>
<ListView android:id="@+id/list" android:layout_width="fill_parent" android:layout_height="wrap_content" ></ListView>
<ImageButton
android:paddingTop="20px"
android:layout_weight="1" android:id="@+id/menu_aboutus"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:background="@drawable/menu_aboutus">
</ImageButton>
<ImageButton android:layout_weight="1" android:id="@+id/menu_help"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:background="@drawable/menu_help">
</ImageButton>
</LinearLayout>