Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6146521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:57:41+00:00 2026-05-23T18:57:41+00:00

I currently have a working gridview displaying some thumbnails. Currently, when you select an

  • 0

I currently have a working gridview displaying some thumbnails. Currently, when you select an image it will save a larger resolution of the image as a wallpaper.

What I want to do is open a new intent and then display the full resolution image based on the GridView position clicked. I’m not sure how I find out what position was clicked from the new activity/intent.

Heres what I have in my main activity

public class test extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    GridView gridview = (GridView) findViewById(R.id.gridview);
    gridview.setAdapter(new ImageAdapter(getApplicationContext()));

    gridview.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
            Toast.makeText(test.this, "" + position + "" + id, Toast.LENGTH_SHORT).show();

            //Make a Bitmap from the Resource
            ImageAdapter i = (ImageAdapter)parent.getAdapter();
            Bitmap mBitmap = BitmapFactory.decodeResource(getResources(),(int)i.getItemId(position));

            //Get the WallpaperManager
            WallpaperManager myWallpaperManager = WallpaperManager.getInstance(getApplicationContext());

            try {
                //Set the clicked bitmap
                myWallpaperManager.setBitmap(mBitmap);
                Toast.makeText(test.this, "Wallpaper set", Toast.LENGTH_SHORT).show();
            } catch (IOException e) {
                Toast.makeText(test.this, "Error setting wallpaper", Toast.LENGTH_SHORT).show();
            }

        }
    });

}

}

ImageAdapter

public class ImageAdapter extends BaseAdapter {

private Context mContext;

public ImageAdapter(Context c) {
    mContext = c;
}

public int getCount() {
    return mThumbIds.length;
}

public Object getItem(int position) {
    return null;
}

public long getItemId(int position) {
    return mFullSizeIds[position];
}

// create a new ImageView for each item referenced by the Adapter
public View getView(int position, View convertView, ViewGroup parent) {
    ImageView imageView;
    if (convertView == null) {  // if it's not recycled, initialize some attributes
        imageView = new ImageView(mContext);
        imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        imageView.setPadding(8, 8, 8, 8);
    } else {
        imageView = (ImageView) convertView;
    }

    imageView.setImageResource(mThumbIds[position]);
    return imageView;
}

// references to our images
private Integer[] mThumbIds = {
        R.drawable.sample_1, R.drawable.sample_2,
        R.drawable.sample_3, R.drawable.sample_4,
        R.drawable.sample_5, R.drawable.sample_6,
        R.drawable.sample_7 
};


private Integer[] mFullSizeIds = {
        R.drawable.wallpaper1,
        R.drawable.wallpaper2,
        R.drawable.wallpaper3,
        R.drawable.wallpaper4,
        R.drawable.wallpaper5,
        R.drawable.wallpaper6,
        R.drawable.wallpaper7
        };

}

And blank FullView template

public class FullView extends Activity {

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fullview);

ImageView imageview;
    imageview.setImageResource(mFullSizeIds[**]) <--- How to set ** to what GridView position was selected?


}

}

I haven’t really written anything in the FullView activity yet due to being unaware of how to pass the position that was clicked from the GridView in this new activity.

(I haven’t written the intent code in my main activity either so you can see how it currently works)

How do I pass the gridview position that was selected into the new activity?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T18:57:42+00:00Added an answer on May 23, 2026 at 6:57 pm

    In your event handler (the OnItemClickListener), you can get the resource ID of the image as mThumbs[position]. Add this as an extra to the Intent you use to start your FullView Activity.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I'm working on gridview it's have textbox on submit click I want to
i have a gridview i am working on VS2008 ASP.Net forms Currently, my update
I'm currently working on an Android application. I wish to have a GridView on
I currently have a gridview that is set up and working properly but I
I currently have NSXMLParser working in my viewcontroller. I would like to create a
I currently have this working but it requires me to have a static method
I am trying to get MSTest working with CruiseControl.Net. I currently have it working
I am working on splitting out an existing, working application that I currently have
I am working on an IMAP client using java mail. We currently have a
I have been working on keeping things object oriented for my project. Currently, I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.