This should be simple, but driving my crazy.
I have the following in my layout, not problems.
<TextView
android:id="@+id/birdinfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#00009c"
android:text="The Robin is a popular bird"
/>
Then I have these arrays which are set up with the list of string resources I have
private Integer[] DetailIds = {
R.string.barnaclegoose,
R.string.barnowl,
R.string.bewicksswan,
R.string.blackbird,
R.string.blackcap_male};
So I simply want to do this!
TextView detail = (TextView)findViewById(R.id.birdinfo);
detail.setText(DetailIds[0]);
setContentView(R.layout.main);
But this causes a force close error.
The string resource looks like this ( without header and footer info of course
<string name="barnaclegoose">What a wonderful goose!</string>
Added to this problem is if I use the resource directly to the resource
detail.setText(R.string.barnaclegoose);
For example, I still get a null exception! I'm sure I've done this before, but maybe I'm missing the obvious???
Any ideas appreciated.
( Eclipse, Android 1.5, Emulator with 1.5 )