一旦单击一个列表项,我就会尝试转移到另一个意图。MatchingInterest
在下面的示例中,我需要在单击属性列表后立即转到另一个意图。
但不知何故,每当我点击属性列表时,它并没有将我重定向到MatchingInterest page
. 知道为什么会这样吗?
public class MenuFragment extends ListFragment {
private String user_id = "1234";
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(getActivity(),
android.R.layout.simple_list_item_1, new String[] { " Settings", " Attributes"}));
getListView().setCacheColorHint(0);
}
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
//get selected items
String selectedValue = (String) getListAdapter().getItem(position);
if(selectedValue.equals("Attributes")) {
Bundle bundle = new Bundle();
bundle.putString("USERID", user_id);
Intent thesisProject = new Intent(getActivity(), MatchingInterest.class);
thesisProject.putExtras(bundle);
startActivity(thesisProject);
}
}
}