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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:32:19+00:00 2026-05-28T04:32:19+00:00

Hi i am creating a custom listview with texview ,imageview and i am accessing

  • 0

Hi i am creating a custom listview with texview ,imageview and i am accessing the data from sqlite database where i am storing name of each image and placing the images in assests folder when i try access it using the holder.mimage.setImageResource(list.get(position).getImage());
it is giving the error how can i access it any suggestion will be very helpfull

public class InteractiveArrayAdapter extends ArrayAdapter<PosHolder> {
String tag = "Events";
private final List<PosHolder> list;
private final Activity context;
int li,jh;



public InteractiveArrayAdapter(Activity context, List<PosHolder> list) {
    super(context, R.layout.row, list);
    this.context = context;
    this.list = list;
}

 static class ViewHolder {
    protected TextView text;
    protected CheckBox checkbox,checkbox1;
    protected RadioGroup mgroup;
    protected RadioButton mbutton;
    protected ImageView mimage;
}




public View getView( final int position, View convertView, ViewGroup parent) {
    //Log.d(tag," 3");

     View view =null;
    if (convertView == null) {
        //System.out.println("ok");
        LayoutInflater inflator = context.getLayoutInflater();
        view = inflator.inflate(R.layout.row, null);
        final ViewHolder viewHolder = new ViewHolder();
        viewHolder.text = (TextView) view.findViewById(R.id.textView1);

        viewHolder.mimage = (ImageView) view.findViewById(R.id.imageView1);




           view.setTag(viewHolder);
           viewHolder.mimage.setTag(list.get(position));


    } else {
        view = convertView;
        ((ViewHolder) view.getTag()).mimage.setTag(list.get(position));


    }
     ViewHolder holder = (ViewHolder) view.getTag();
    view.getTag()).mgroup.getTag();
     holder.text.setText(list.get(position).getName());
     holder.mimage.setImageResource(list.get(position).getImage());//This line is showing the error

    return view;

}
public class PosHolder {
private String name;
private String smallimage;


public PosHolder(String name, String smallimage) {
    // TODO Auto-generated constructor stub

    this.name=name;
    this.smallimage=smallimage;
}
public String getName() {
    return name;
}
public void setName(String name) {
    this.name = name;
}
public String getImage() {
    return smallimage;
}
public void setImage(String phone) {
    this.smallimage = phone;
}}
  • 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-28T04:32:20+00:00Added an answer on May 28, 2026 at 4:32 am

    It’s becoz you are passing name of image to the imageView not the IMAGE. you are retrving imageName instand of image from the list of PosHolder object. Your PosHolder object giving you string not the image

    public String getImage() 
    {     
        return smallimage; 
    }
    

    this is causing exception.

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

Sidebar

Related Questions

I am creating a custom listview. The data is not coming from a cursor
Jython is great for creating custom data structures on need basis, but how to
I have mastered creating custom data types and adding fields with CCK. Then I
In WPF, we are creating custom controls that inherit from button with completely drawn-from-scratch
After creating a custom Dialog using a ListView and my own implementation of ListAdapter
I have a listview that's populated by rows that get their data from a
I currently have a custom listview with two rows of text in each item,
I'm creating custom UINavigationItem with custom background image and title. The image is shown
I am creating custom images that I later convert to an image pyramid for
hi i am creating a custom listview with two chekboxes and problen is when

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.