Hello all,
I am a newb to Android and Java and want to write a funtion that will display a list based on a varable that I pass to the function.
The function is below and the code below creates an array out of a string called type, but what I want to do is pass it a variable string and have it build a list based on that string.
So if I wanted the type list I would say list_it("type")
But if I try something like getResources().getStringArray(R.array.thelist); it doesn't work.
Can someone point me in the right direction?
public void list_it(String thelist){
String[] types = getResources().getStringArray(R.array.type);
ArrayAdapter<String> mAdapter = new ArrayAdapter<String>(this, R.layout.list_item1, types);
setListAdapter(mAdapter);
ListView lv = getListView();
lv.setTextFilterEnabled(true);
}