Skip to content

Instantly share code, notes, and snippets.

@CoffeeCode
Created May 26, 2014 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CoffeeCode/70fcce8e56773ec60680 to your computer and use it in GitHub Desktop.
Save CoffeeCode/70fcce8e56773ec60680 to your computer and use it in GitHub Desktop.
AdapterView.OnItemClickListener myOnItemClickListener = new AdapterView.OnItemClickListener(){
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
FragmentViewPager fragment = new FragmentViewPager();
Bundle args = new Bundle();
args.putInt(FragmentGalleryViewPager.BUNDLE_STATE_POSITION, position);
args.putString(FragmentGalleryViewPager.BUNDLE_STATE_SELECTION, selection);
fragment.setArguments(args);
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.content_frame, fragment);
transaction.addToBackStack(null);
transaction.commit();
}};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment