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

Categories

HOME
batch-file
go
ns-3
recordrtc
joomla3.0
bing-maps
windows-ce
datastage
jxl
tput
scrolltop
gruntfile
aws-sdk
jmp
nim
gmm
rubymotion
blade
postscript
qliksense
aggregation
resourcebundle
draft-js-plugins
definitelytyped
interbase
oculus
tpm
bringtofront
anki
database-comparison
angularjs-material
fstream
dynamic-jasper
nested-lists
jwplayer6
python-pptx
sql-server-ce
tex
diacritics
dcmtk
clang++
openrasta
aquamacs
pair-programming
backbone-collections
java-websocket
gpg-signature
jtree
chromium-os
usart
simplepie
flex-monkey
vulcanize
neon
beamer
scaffolding
simevents
angular-ui-typeahead
fuzzywuzzy
highland.js
jbase
decimalformat
roadkill-wiki
batik
iced-coffeescript
jquery-forms-plugin
shopizer
broadband
phpldapadmin
android-cookiemanager
formview
kissfft
multitasking
gtm-oauth2
jammer
windows-phone-8-sdk
node-blade
epiceditor
http-status-code-410
pdfviewer
curb
monotouch.dialog
cakephp-1.2
oracle-enterprise-linux
google-maps-mobile
role
expression-blend-4
screen-size
updatesourcetrigger
glui
wcf-instancing
wordprocessingml
cldc
fault-tolerance
business-model
dsoframer

Resources

Encrypt Message