I have two activity, first of which contains few buttons and the second one shows listview. For each button there is a particular array. Now i want to show for each onClick method in First activity, listview in 2nd activity should populate with that particular array. I can have separate Class for each Array. But for large numbers of array, there will be same no. of Classes. Any help will be appreciated. Below is my code : 1st Activity
public void onClick1 (View view){
startActivity(new Intent ("com.questions"));
}
public void onClick2 (View view){
startActivity(new Intent ("com.questions"));
}
2nd Activity :
public static class mSectionFragment extends ListFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.common_listview, container, false);
final String[] sm = getResources().getStringArray(R.array.first_array);
setListAdapter(new ArrayAdapter<String>(getActivity(),
android.R.layout.simple_list_item_1, sm));
setListAdapter(getListAdapter());
return rootView;
}
}
now i want to change R.array.first_array to second_array for onClick2