package com.exercise.AndroidList;
import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
public class AndroidList extends ListActivity {
String[] DayOfWeek = {"Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday", "Friday", "Saturday"
};
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);
setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, DayOfWeek));
}
}
Download the souce files.
next: ListView, with icon
Hi Androic Eric,
ReplyDeleteThanks for the tutorial, it was informative enough.
I followed the steps you take in creating the listview but when i opened emulator, it says "unfortunately, the app has stopped."
Am I doing something wrong? Please help. Thanks
Strong recommend NOT to test on Android Emulator, many weird exception will happen!
ReplyDeleteThanks Eric. What other ways to test my apps then. How would I know it is functioning well before i test it on my phone.
ReplyDeleteHi Eric, I have tried testing it on my phone but no luck.I installed the apk file on my android phone but gave same result as the emulator on eclipse.
ReplyDeleteHere is the code. Pls check if i have missed anything here. Thanks for your time.
package com.exercise.androidlist;
import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
public class AndroidList extends ListActivity {
String[] DayOfWeek = {"Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday", "Friday", "Saturday"
};
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);
setListAdapter(new ArrayAdapter(this,
android.R.layout.simple_list_item_1, DayOfWeek));
}
}
hello Muritala Bakare,
ReplyDeletefor me, I will test on true device.
I tried to re-do it without problem. You can try it: http://adf.ly/dUdoQ
ReplyDelete