Hi All,
I am trying to call android activity on click of GridView item, I have 4 menu option in GridView so want to call activity based on clicked item.
gridView.ItemClick += delegate (object sender, AdapterView.ItemClickEventArgs args) {
// here I want to call next activity
};
Kindly suggest that how can I get item value and compare that to call activity.
Thanks
Arun
Answers
StartActivity (typeof(YourActivity));
Thanks Beray for answer
Let me clarify what I want to do, I have created dashboard using GridView and having 4 menu options in that. Each menu has one Activity class and I am not able to call specific activity based on item clicked in GridView. GridView layout is having Image and Text View to show up menu.
gridView.ItemClick += delegate (object sender, AdapterView.ItemClickEventArgs args) {
Toast.MakeText(this, args.Position.ToString(), ToastLength.Short).Show(); // in this I am only getting item poistion
StartActivity(typeof(CreateServiceRequest)); // here I am able to call single activity but no decision making call
};
So will I get only item position on GridView click and that only be the logic to next Activity?
If I am not that much clear please let me know any option to connect back to you so I can make you understand complete scenario.
Thanks,
G Arun
this is my problem toooooo
please answer this question
@G.Arun , @AljohnPopeAndrade
Hi friends,
public class Page { public string Title {get; set;} public Type PageType {get; set;} }
private List<Page> _pages;
and you fill it like :_pages= new List<Page>(); _pages.Add(new Page() { Title="Page 1", PageType = typeof(Your_1_activity) } _pages.Add(new Page() { Title="Page 2", PageType = typeof(Your_2_activity) } _pages.Add(new Page() { Title="Page 3", PageType = typeof(Your_3_activity) } _pages.Add(new Page() { Title="Page 4", PageType = typeof(Your_4_activity) }
gridView.ItemClick += delegate (object sender, AdapterView.ItemClickEventArgs args) { StartActivity(_pages[args.Position].PageType); // here you are able to call the activity you need };
Hope that helps
Mabrouk.
Sir, very well said thank you so much for this..
i hope i can ask some question to you when i need help for this gridview haha
Im a newbee sir btw
what is page,title type,pagetype ?
@AljohnPopeAndrade
You are wlcm