I'm trying to lunch another activity from my main activity using a button i placed on my main activity, now the button also prints "call activity" and it works fine, but when the second activity lunched it seems like it doesn't execute oncreate method, it doesn't print "start" and doesn't call GetCar();. The only thing it does is to show the xml.
button that lunches second activity (print "call activity" is working fine)
public void allCars(View v){
setContentView(R.layout.activity_cars_menu);
System.out.println("call activity");
}
second activity code (doesn't print "start" or call GetCar().)
public class CarsMenu extends Activity {
Button btn;
public static String[] carId;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cars_menu);
System.out.println("start");
GetCar();
}
second activity xml (can't see viewlist probably because i can't set text (doesn't call GetCar()) .
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
all of my activity is on the manifest and i'm not getting any errors on logcat.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="${packageName}.${activityClass}" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:onClick="btnCarClick"
android:text="Refresh" />
<ListView
android:id="@+id/MlistView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/button1"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true">
</ListView>
</RelativeLayout>
0 comments:
Post a Comment