i am very new to android and i am stuck here. i have a gridview that is showing images from my sdcard, and a check box with each image for multiple selection. Now after selection, i want to send the images as to a servlet in a multipart http request. i think(correct me if i m wrong) that i need the image URIs to do that but i have no way of getting them after the menu item is selected. Here is the code
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId())
{
case R.id.sendPics:
// TODO - add code to get and send pics
GridView grid = (GridView) findViewById(R.id.imageGrid);
ImageAdapter imageAdapter = (ImageAdapter) (grid.getAdapter());
for (int i = 0; i < grid.getChildCount(); i++)
{
Images im = (Images) imageAdapter.getItem(i);
View view = grid.getChildAt(i);
CheckBox cb = (CheckBox) view.findViewById(R.id.checkbox);
// ImageView iv = (ImageView) view.findViewById(R.id.image);
if (cb.isChecked())
{
Log.d(TAG, ">>>>>>>>>>checked check box found<<<<<<<<<<");
// TODO get the image path hre to send as a multipart http request
}
}
return true;
default:
return super.onOptionsItemSelected(item);
}
}
i get the image adapter to get the Loaded Image form this post android How to get image path from GridView through onItemClick listener but i cant find any LoadedImage class in my project so totally stuck. any help will be much appreciated.
edit: Images im = (Images) imageAdapter.getItem(i); in this line i cudnt find LoadedImage class so i thought to try with Images which is wrong.