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 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 an activity which consists of a ListView . The problem is that
I have an Activity, which simply consists in listing Pair<String, String> objects. I have
I have an activity which uses two Loaders. Each of them returns different type
I have an activity which has two edit text fields: one for the title
I have an application, which consists of 3 activities. In the first activity I
I have an Activity which has two different layouts based on grid view and
I have Activity A which calls B, at which point let's say the user
I have an array on my Activity which consist R.drawables images declared inside a

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.