android
android - menu gui difficulty
When I use a simple array that i define in this class, it works fine, but when I call on this string array from my strings.xml, it never seems to work....Any suggestions? I'm trying to make a menu that lists all the chapter titles What am I doing wrong??? I'm pretty new to java and android, so please dumb it down as much as possible....Thanks! import android.app.ListActivity; import android.content.res.Resources; import android.os.Bundle; import android.widget.ArrayAdapter; public class ChapterMenu extends ListActivity{ Resources res= getResources(); String [] chapterArray = res.getStringArray(R.array.chapters); #Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setListAdapter(new ArrayAdapter<String>(ChapterMenu.this, android.R.layout.simple_list_item_1, chapterArray)); }
#Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); Resources res= getResources(); String [] chapterArray = res.getStringArray(R.array.chapters); setListAdapter(new ArrayAdapter<String>(ChapterMenu.this, android.R.layout.simple_list_item_1, chapterArray)); }
Related Links
Can I make a public folder (accessible for user) on internal storage
Failure to install APK [INSTALL_FAILED_DEXOPT] Android Studio
Trying to restore state of activity upon starting it via a notification
How to make a sliding animation in scrollview when the keyboard shows up
Android: FragmentStatePageAdapter not updating ListView
Funny things happening with putExtra and getIntExtra
Custom view draw circle produces elipse
Most efficient way to share data between a Service and an Activity
Android EditText.setText OutOfMemoryError when string is very large
Android Studio Robolectric missing android.R
Radio button group bad showing in some android devices
Layout not displaying correct when using ListFragment to display a list of items
Are the objects and instance variables eligible for GC if a service is destroyed?
Rotating image decentres image using janmuller library
Android: How to calculate progress percentage for multiple files upload
Contents of ArrayList<HashMap<String,String>> not getting set in ListView when inflating two different layouts in android