/** * Create a new instance of DetailFragment. * @param resourceId The resource ID of the Drawable image to show * @param title The title of the image * @param x The horizontal position of the grid item in pixel * @param y The vertical position of the grid item in pixel * @param width The width of the grid item in pixel * @param height The height of the grid item in pixel * @return a new instance of DetailFragment */ public static DetailFragment NewInstance (int resourceId, string title, int x, int y, int width, int height) { var fragment = new DetailFragment (); var args = new Bundle (); args.PutInt (ARG_RESOURCE_ID, resourceId); args.PutString (ARG_TITLE, title); args.PutInt (ARG_X, x); args.PutInt (ARG_Y, y); args.PutInt (ARG_WIDTH, width); args.PutInt (ARG_HEIGHT, height); fragment.Arguments = args; return fragment; }
/** * Create a new instance of DetailFragment. * @param resourceId The resource ID of the Drawable image to show * @param title The title of the image * @param x The horizontal position of the grid item in pixel * @param y The vertical position of the grid item in pixel * @param width The width of the grid item in pixel * @param height The height of the grid item in pixel * @return a new instance of DetailFragment */ public static DetailFragment NewInstance(int resourceId, string title, int x, int y, int width, int height) { var fragment = new DetailFragment(); var args = new Bundle(); args.PutInt(ARG_RESOURCE_ID, resourceId); args.PutString(ARG_TITLE, title); args.PutInt(ARG_X, x); args.PutInt(ARG_Y, y); args.PutInt(ARG_WIDTH, width); args.PutInt(ARG_HEIGHT, height); fragment.Arguments = args; return(fragment); }
public void OnItemClick(AdapterView parent, View view, int position, long id) { Meat meat = mAdapter [position]; Log.Info(TAG, meat.title + " clicked. Replacing fragment."); // We start the fragment transaction here. It is just an ordinary fragment transaction. FragmentManager .BeginTransaction() .Replace(Resource.Id.sample_content_fragment, DetailFragment.NewInstance(meat.resourceId, meat.title, (int)view.GetX(), (int)view.GetY(), view.Width, view.Height) ) // We push the fragment transaction to back stack. User can go back to the // previous fragment by pressing back button. .AddToBackStack("detail") .Commit(); }