R.raw is almost certainly not going to be a string array. You need to
define a string array in values/<somefile>.xml, with the following markup:
<resources>
<string-array name="resourceName">
<item>string1</item>
<item>string2</item>
</string-array>
</resources>
On Wed, Nov 4, 2009 at 12:57 AM, [email protected] <
[email protected]> 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 [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
--
Dianne Hackborn
Android framework engineer
[email protected]
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en