android intent - How to link a activity in gridview which has images and text using fragments to open a new activity? -
i wanted open next activity games in contain games wallpapers, whenever click on games on phone shows unfortunately app stopped.. next activity not opening... , please tell me how open image games activity on next activity gallery..
public class categoryfragment extends fragment { gridview list; string[] web = { "games", "movies", "nature", "celebrities", "songs", "sports", "cute", "cartoons", "others" } ; integer[] imageid = { r.drawable.cat1, r.drawable.cat2, r.drawable.cat3, r.drawable.cat4, r.drawable.cat5, r.drawable.cat6, r.drawable.cat7, r.drawable.a1, r.drawable.cat9, }; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.fragment_category, container, false); list=(gridview) rootview.findviewbyid(r.id.list); customlist = new customlist(getactivity(), web, imageid); list.setadapter(a); list.setonitemclicklistener(new adapterview.onitemclicklistener() { @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { toast.maketext(getactivity(), "you clicked @ " +web[+ position], toast.length_short).show(); string s = web[position]; if (s.equals("games")) { toast.maketext(getactivity(), "games fragment", toast.length_short).show(); intent i1 = new intent(getactivity(), games.class); startactivity(i1); } } }); return rootview; } }
Comments
Post a Comment