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 9067859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:02:55+00:00 2026-06-16T17:02:55+00:00

I have a gridview which I am inflating in a Dialog view. Now when

  • 0

I have a gridview which I am inflating in a Dialog view.
Now when I open the dialog ( with Grid View ) it shows a set of 10 images.

when dialog is dismissed the image which I selected is set on the ImageView.

Now my query is can I get the name of the image?? which is set on the ImageView???

I have to save it somehwere.

@Override
public void onClick(View view) {
    // TODO Auto-generated method stub
    final Dialog groupIconsDialog = new Dialog(CreateGroupActivity.this);
    groupIconsDialog.setTitle("Choose Group Icon");
    groupIconsDialog.setContentView(R.layout.group_icons_layout);
    //calling and setting the image icons to the grid view adapter
    GridView groupIconsGrid = (GridView)groupIconsDialog.findViewById(R.id.grid_groupIcons);
    groupIconsGrid.setAdapter(new GroupIconAdapter(CreateGroupActivity.this));

    groupIconsGrid.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1,
                        int position, long arg3) {
                    // TODO Auto-generated method stub

                    group_icon.setImageResource(new GroupIconAdapter(CreateGroupActivity.this).mThumbIds[position]);
                    groupIconsDialog.dismiss();

                }

            });

            groupIconsDialog.show();

        }
    });

ImageAdapter

public class GroupIconAdapter extends BaseAdapter {

    private Context mContext;

    //icons image array
     public Integer[] mThumbIds = {
                R.drawable.mogra,R.drawable.rhino,
                R.drawable.zebra,R.drawable.lion,
                R.drawable.mogra,R.drawable.rhino,
                R.drawable.giraffee,R.drawable.giraffee,
                R.drawable.lion,R.drawable.rhino
        };

     public GroupIconAdapter(Context c) {
        // TODO Auto-generated constructor stub
         mContext = c;
     }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return mThumbIds.length;
    }

    @Override
    public Object getItem(int position) {
        // TODO Auto-generated method stub
        return mThumbIds[position];
    }

    @Override
    public long getItemId(int arg0) {
        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    public View getView(int position, View view, ViewGroup parent) {
        // TODO Auto-generated method stub
        ImageView imageView = new ImageView(mContext);
        imageView.setImageResource(mThumbIds[position]);
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        imageView.setLayoutParams(new GridView.LayoutParams(50, 50));
        return imageView;
        }
}
  • 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-06-16T17:02:56+00:00Added an answer on June 16, 2026 at 5:02 pm

    Yes you can get the name of the Image if you have the resource id of the Image. You can use getResourceEntryName(resourceId)

    String name = getResources().getResourceEntryName(mThumbIds[position]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a GridView in which each row has a custom view. The grid
I have a gridview which displays data for all employees and their images (stored
I have gridview in which i have check box control Like this image. Problem
I have a gridview which looks like ID Filename Type ----------------------------------------------------- Share view 1
I have a gridview which shows all the information of the data table. I
I have a GridView which shows only 50 records at a time through paging.
I have a gridview which contains checkbox and paging is enabled. Now when I
I have a gridview which contains a text box as a template field.the grid
I have a gridview which will contain some 'n' number of rows.... Now i
I have a GridView which uses BoundField for columns. I am trying to set

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.