我有一个应用程序,它使用下面的代码显示第一个列表。单击以下代码中的任何列表项时,如何在更多列表中显示。请帮助我提供示例代码。
public class MyListFragment1 extends ListFragment {
String[] VideoSetup ={
"Properties",
"Color Control",
"Tint",
"3D Depth",
"3D Format",
"Dynamic Backlight",
"Mode",
"Cache ID",
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ListAdapter myListAdapter = new ArrayAdapter<String>(
getActivity(),
android.R.layout.simple_list_item_1,
VideoSetup);
setListAdapter(myListAdapter);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.listfragment1, container, false);
}
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
Toast.makeText(
getActivity(),
getListView().getItemAtPosition(position).toString(),
Toast.LENGTH_LONG).show();
Fragment2 frag = (Fragment2) getFragmentManager().findFragmentById(R.id.fragment2);
}
}
我不太确定这样做。我对安卓很陌生。