Code example for ListFragment

Methods: onListItemClick, getActivity, startActivity

0
            return inflater.inflate(R.layout.fragment, null);
        } 
 
        @Override 
        public void onListItemClick(ListView l, View v, int position, long id) {
            super.onListItemClick(l, v, position, id);
            Intent intent = new Intent();
            intent.setClass(getActivity(), ViewActivity.class);
            Bundle bundle = new Bundle();
            bundle.putString("defStrID", Integer.toString(position));
            intent.putExtras(bundle);
            startActivity(intent);
        } 
    } 
 
} 
Experience pair programming with AI  Get Codota for Java