开发者

Getting array in android is returning null

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜