I have an array in an xml file that i'm trying to access, however it is returning null.
XML:
<array name="phone">
<item>178092724开发者_Python百科26</item>
<item>17809272426</item>
//etc...
</array>
Java:
String[] phonenumber;
phonenumber = getResources().getStringArray(R.array.phone);
Toast callContact = Toast.makeText(getApplicationContext(), phonenumber[position], Toast.LENGTH_SHORT);
callContact.show(); //blank but it shouldn't be...
Intent contactdial = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + (phonenumber[position])));
startActivity(contactdial);
Thanks =D
Just double check your syntax there, instead of array
use string-array
.
精彩评论