Android 引用字符串数组

Android 引用字符串数组,android,string,Android,String,我有一个困扰我的问题。我在strings.xml中创建了一个字符串数组,称为bookmark\u titles。我想在我的警报对话框中使用它,并使用它们填充一个列表,但是我在R.array中看不到我的数组名称,它只有那些内置在android中的例如PhoneType。如何引用数组 strings.xml 试试“数组”: 谷歌 宾 针对以下国家的文件: 这应该是数组类型,即R.array.foo 使用数组而不是字符串数组: <string name="bookmark_google"

我有一个困扰我的问题。我在
strings.xml
中创建了一个字符串数组,称为
bookmark\u titles
。我想在我的警报对话框中使用它,并使用它们填充一个列表,但是我在
R.array
中看不到我的数组名称,它只有那些内置在android中的例如PhoneType。如何引用数组

strings.xml

试试“数组”:


谷歌
宾
针对以下国家的文件:

这应该是数组类型,即R.array.foo

使用
数组
而不是
字符串数组

<string name="bookmark_google">Google</string>
<string name="bookmark_bing">Bing</string>
<string name="bookmark_yahoo">Yahoo</string>

<array name="pref_values_sort_list">
    <item>@string/bookmark_google</item>
    <item>@string/bookmark_bing</item>
    <item>@string/bookmark_yahoo</item>
</array>
Google
宾
雅虎
@字符串/书签\u谷歌
@字符串/书签\u bing
@字符串/书签\u yahoo
解决了这个问题


我不得不删除import.android.R,之后,它就成功了!谢谢大家

你们试过清理/重建吗?找不到它不显示为
R.array.bookmark\u titles
的原因。请像
R.array.bookmark\u titles
一样引用它。更多信息@。也检查一下。@Joachim Isaksson是的,我清理了这个项目,同样issue@Frugo尝试删除
来自
builder.setTitle(“书籍是:”)
。我认为这不是问题。我刚刚用字符串数组试用了一下。
public class FireMissilesDialogFragment extends DialogFragment{

public Dialog onCreateDialog(Bundle savedInstanceState) {
     AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setTitle("Books are :");
               .setItems(R.array., new DialogInterface.OnClickListener() {   ---> can't see reference here
                   public void onClick(DialogInterface dialog, int which) {
                   // The 'which' argument contains the index position
                   // of the selected item
               }
        });
        return builder.create();

    }
<array name="bookmark_titles">
<item>Google</item>
<item>Bing</item>
</array>
<string name="bookmark_google">Google</string>
<string name="bookmark_bing">Bing</string>
<string name="bookmark_yahoo">Yahoo</string>

<array name="pref_values_sort_list">
    <item>@string/bookmark_google</item>
    <item>@string/bookmark_bing</item>
    <item>@string/bookmark_yahoo</item>
</array>