Wednesday, November 4, 2009

[android-developers] data in xml res/raw

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

No comments:

Post a Comment