<resources>
<string-array name="resourceName">
<item>string1</item>
<item>string2</item>
</string-array>
</resources>
On Wed, Nov 4, 2009 at 12:57 AM, stephane.castrec@gmail.com <stephane.castrec@gmail.com> wrote:
Hi !
I want to get the string in my xml and create button with this text.
But my code (below) doesn't work. I don't know why? there is an
exception : String array resource id #0x7F0400000
android.content.resources$NotFoundException: String array
Morever, I have used this method to store my data. But i 'd like to
know how save more data in this raw/files.
Thanks
Java:
String[] myShowName = this.getResources().getStringArray
(R.raw.seriesname);
Log.i("US Finder", "serie "+myShowName[0]);
//for each element in xml create button
for (int i=0; i<myShowName.length; i++)
{
Log.i("US Finder", "serie "+myShowName[i]);
_btn[i]= new Button(this);
_btn[i].setText(myShowName[i]);
_btn[i].setGravity(Gravity.CENTER_HORIZONTAL);
_btn[i].setOnClickListener(this);
myLayout.addView(_btn[i]);
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--
Dianne Hackborn
Android framework engineer
hackbod@android.com
Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them.
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment