我想创建一个 class ,其中 ListView 的单词将来自。我怎样才能做到?
I want to create a class where the words for the ListView will come from. How i can make it?
我想创建一个 class ListView 的文字来源。
类似这样的,我展示的不行,我是这样做的,举个例子!如何连接它们?
像这样:
ListViewM.java
package great.biron.dargin;
public class ListViewM {
private String mWords [] = {
"Word1",
"Word2"
};
}
Dictionary.java
//Variable start
private ListViewM mWords = new ListViewM();
//Variable end
//onCreate
myArrayList.add(mWords);
你可以试试这个
public class ListViewM {
public static List<String> getWords() {
return Arrays.asList("Word1", "Word2");
};
}
我想创建一个 class ListView 的文字来源。
类似这样的,我展示的不行,我是这样做的,举个例子!如何连接它们? 像这样:
ListViewM.java
package great.biron.dargin;
public class ListViewM {
private String mWords [] = {
"Word1",
"Word2"
};
}
Dictionary.java
//Variable start
private ListViewM mWords = new ListViewM();
//Variable end
//onCreate
myArrayList.add(mWords);
你可以试试这个
public class ListViewM {
public static List<String> getWords() {
return Arrays.asList("Word1", "Word2");
};
}