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

  • Home
  • SEARCH
  • 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 6134309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:20:20+00:00 2026-05-23T17:20:20+00:00

I have an activity which consists of a GridView with multiple (different) images. When

  • 0

I have an activity which consists of a GridView with multiple (different) images. When the user clicks on one image, a customized dialog box shows up in which an enlarged version of the image appears as well as some text below.

What I want accomplished: the image shown in the dialog box must correspond to the chosen image in the GridView. I thought that I could change the image resource in the onItemClick method, but the application crashes instead (only when I use the setImageResource command).

Here is the code:

public class Releases extends OptionsActivity 
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.releases);

        GridView gridview = (GridView) findViewById(R.id.gridview);
        gridview.setAdapter(new ReleasesImgAdapter(this));

        gridview.setOnItemClickListener(new OnItemClickListener()
        {
            public void onItemClick(AdapterView<?> parent, View v, int position, long id)
            {
                //Toast.makeText(Releases.this, "" + position, Toast.LENGTH_SHORT).show();
                if (position == 0)
                {                   
                    CustomizeDialog cdWCE = new CustomizeDialog(Releases.this, R.layout.releases_popup);
                    ImageView wce = (ImageView)findViewById(R.id.rlsImg);                                       
                    wce.setImageResource(R.drawable.image2);
                    cdWCE.show();                   
                }
            }
        });
    }
}

releases.xml simply consists of a GridView.

I can’t debug the program because my Eclipse debugging haven’t been working for a while now.

  • 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-23T17:20:20+00:00Added an answer on May 23, 2026 at 5:20 pm

    Try finding the ImageView in the actual dialog where you set the layout (e.g.

    ImageView wce = (ImageView)cdWCE.findViewById(R.id.rlsImg);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 activities. Activity 1 is the 'Homepage' which consists of one spinner.
I have one activity which can be open from more 4 or 5 different
I have a couple of tables which are used to log user activity for
I have 2 models - User and Activity - which are related by a
I have some 34 checkboxes on one Activity which i have to mark and
I have Activity A which calls B, at which point let's say the user
I have a activity (ListActivity) in which if a user click on a button,
I have an Activity which I want to be finished when user rotates the
I have an activity which shows 3 random images from JSON data off the
I have one activity in which I am having one TabHost with two tabs.

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.