Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid : gridview
    primarykey
    data
    text
    <p>I have a gridview in one screen and in gridview i am displaying all the images which is present in SDCard this is working fine. Now what i want to do is when i click on any of gridview images it should go to next activity and should display that particular image in full screen. I have referred some other link and tried but not getting proper solution.</p> <pre><code> public class Gallary_Images extends Activity { private Cursor cursor; private int columnIndex; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.gallery_images); // Set up an array of the Thumbnail Image ID column we want String[] projection = { MediaStore.Images.Thumbnails._ID }; // Create the cursor pointing to the SDCard cursor = managedQuery( MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, projection, null, // Return all rows null, MediaStore.Images.Thumbnails.IMAGE_ID); // Get the column index of the Thumbnails Image ID columnIndex = cursor .getColumnIndexOrThrow(MediaStore.Images.Thumbnails._ID); GridView sdcardImages = (GridView) findViewById(R.id.gridView1); sdcardImages.setAdapter(new ImageAdapter(this)); // Set up a click listener sdcardImages.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView parent, View v, int position, long id) { Intent i = new Intent(getApplicationContext(), ViewGallery_Photo.class); i.putExtra("id", position); startActivity(i); } }); } private class ImageAdapter extends BaseAdapter { private Context context; public ImageAdapter(Context localContext) { context = localContext; } public int getCount() { return cursor.getCount(); } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View convertView, ViewGroup parent) { ImageView picturesView; if (convertView == null) { picturesView = new ImageView(context); // Move cursor to current position cursor.moveToPosition(position); // Get the current value for the requested column int imageID = cursor.getInt(columnIndex); // Set the content of the image based on the provided URI picturesView.setImageURI(Uri.withAppendedPath( MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, "" + imageID)); picturesView.setScaleType(ImageView.ScaleType.FIT_CENTER); picturesView.setPadding(8, 8, 8, 8); picturesView .setLayoutParams(new GridView.LayoutParams(100, 100)); } else { picturesView = (ImageView) convertView; } return picturesView; } } } </code></pre> <p>This is my gridview class where i am calling next activity. Now i don't know how should i get the images in next activity. Please help...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload