0
我在xml文件中有一个数组,它试图访问,但是它返回null。在android中获取数组返回null
XML:
<array name="phone">
<item>17809272426</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);
感谢= d
非常感谢^^ – gammaraptor