2011-08-03 7 views
0

私はアクセスしようとしているxmlファイルに配列を持っていますが、nullを返しています。アンドロイドで配列を取得すると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

答えて

2

おかげだけではなく、array使用string-arrayの、そこにあなたのsyntaxをダブルチェック。

+0

ありがとうございました^^ – gammaraptor

関連する問題