I am developing Splash screen,GridView, ListView and 4 other codes.
Since every item click in GridView namely Image,video,document and upload displays the same items in ListView(my code is like that) I am confused as to how to apply the loops in the onItemClick(AdapterView parent, View view, int position, long id) method so that i can display image code,video code,document code and uploading code in accordance with the items in GridView and ListView
To be very precise just go through the flow below
1.Image(Grid View)—–Onclick—->Item1(listview)–Onclick()–>Image Code
---->Item2(listview)--Onclick()-->Image Code
---->Item3(listview)--Onclick()-->Image Code
---->Item4(listview)--Onclick()-->Image Code
2.Video(Grid View)—–Onclick—->Item1(listview)–Onclick()–>Video Code
---->Item2(listview)--Onclick()-->Video Code
---->Item3(listview)--Onclick()-->Video Code
---->Item4(listview)--Onclick()-->Video Code
3.Document(Grid View)—–Onclick—->Item1(listview)–Onclick()–>Document Code
---->Item2(listview)--Onclick()-->Document Code
---->Item3(listview)--Onclick()-->Document Code
---->Item4(listview)--Onclick()-->DocumentCode
4.Upload(Grid View)—–Onclick—->Item1(listview)–Onclick()–>Upload Code
---->Item2(listview)--Onclick()-->Upload Code
---->Item3(listview)--Onclick()-->Upload Code
---->Item4(listview)--Onclick()-->UploadCode
Thanks in advance if anybody could help it would be fantastic
If your grid screen and list screen are seperate activities, then you can pass the “type” of the grid option that was selected by the user as an extra in the intent you are using to start the list activity. And then depending on this value, you can decide the action that is to be taken in the onItemClick.
Hope that helps.
Define the types for your operations. like,
public static final int OPTION_IMAGECODE = 1 ;
public static final int OPTION_VIDEOCODE = 2 ; …etc
and a varaible to hold the type like, private int selectedGridOption ;
When user clicks on the grid option, populate the variable. Like,
selectedGridOption = OPTION_IMAGECODE ; if the user selectes the image type.
In your intent you use to start the list activity put this value as an extra. Like,
listActivityIntent.putExtra(“Selected Option”, selectedGridOption) ;
In you list activity you can retreive this value as,
getIntent().getIntExtra(“Selected Option”, *default_value_you_want*) ;