I'm fairly new to Java and Android and so far I have an ActionBar with 6 Tabs going. In the Fragments is a ListView which gets it's values from a string-array out of a custom data.xml. In this data.xml are 6 string-arrays and I want to change the ListView values to another string-array when I go to another Tab.
Maybe I'm even going a wrong way. I want to create 6 Tabs which contain a speficic ListView and it should open a new "page" when an ListView Item is selected.
getActionBar().getSelectedTab().getPosition();
getPosition was the closest I got so far but I'm not sure how to change my "strListView" based on selected Tab.
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment, container, false);
myListView = (ListView) rootView.findViewById(R.id.ListView);
strListView = getResources().getStringArray(R.array.CHANGABLESTRINGARRAY);
ArrayAdapter<String> objAdapter = new ArrayAdapter<String>(this.getActivity(), android.R.layout.simple_list_item_1, strListView);
myListView.setAdapter(objAdapter);
myListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
}
});
return rootView;
}
0 comments:
Post a Comment