FragmentでgridViewのsetOnItemClickListenerが取得できません。何が問題になる可能性がありますか?
これが私のコードです::
public class MainMenuFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.main_menu_fragment, container, false);
itemsGridViewObj = (GridView) view.findViewById(R.id.itemsGridView);
itemsGridViewObj.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position,
long arg3) {
Log.d(TAG, "--> onItemClick listener..."); // Can not getting this method.
/*if(position == 1) {
FruitMenuFragment fruitMenuFragment = new FruitMenuFragment();
fragmentTransaction.replace(android.R.id.content, fruitMenuFragment);
fragmentTransaction.commit();
}*/
}
});
return view;
}
}`