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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:27:18+00:00 2026-06-16T01:27:18+00:00

I have a few images that I have stored inside the internal storage. I

  • 0

I have a few images that I have stored inside the internal storage. I managed to retrieve the image file location and decode it. But I could not manage to get it to display inside a gridview. And I’m not sure what’s wrong with the codes due to there is no error at the moment. Any comments will be appreciated.

    protected void onCreate(Bundle savedInstanceState) 
{   
    super.onCreate(savedInstanceState);
    setContentView(R.layout.web_tab);
    helper = new DBHelper(this);
    Object[] values = helper.get_contentByEmailID(EMAIL);
    this.arrPath = new String[this.count];
    this.thumbnailsselection = new boolean[this.count];

    Log.i(TAG, "values:" +values);
    Log.i(TAG, "filepath:" +values[0]);
    Log.i(TAG, "filepath:" +values[1]);
    Log.i(TAG, "values:" +values.length);

    if(values.length>0){
        for (int i=0;i<values.length;i++){
            Log.i(TAG, "values[]" +values[i]);
            String bImage = (String) values[i];
            bitmap = new Bitmap [this.count];
            bitmap = decodeFile(bImage);


            Log.i(TAG, "bImage"+i+":" +bImage);
            Log.i(TAG, "bitmap"+i+":" +bitmap);
        }
    }
    else{
        Log.i(TAG, "Unable to locate images");
    }


    imagegrid = (GridView) findViewById(R.id.WebImageGrid);
    imageAdapter = new ImageAdapter();
    imagegrid.setAdapter(imageAdapter);


}

Below is the ImageAdapter code.

public class ImageAdapter extends BaseAdapter
{
    private Context mContext;       
    Bitmap[] mImageArray;
    private LayoutInflater mInflater;

    public ImageAdapter() {
        mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }
    @Override
    public int getCount() {
        return count;
    }
    public Object getItem(int position)
    {
          return position;
    }
    public long getItemId(int position)
    {
          return position;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView == null) {  
            holder = new ViewHolder();
            convertView = mInflater.inflate(
                    R.layout.galleryitem, null);
            holder.imageview = (ImageView) convertView.findViewById(R.id.thumbImage);
            holder.checkbox = (CheckBox) convertView.findViewById(R.id.itemCheckBox);

            convertView.setTag(holder);
        }
        else {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.checkbox.setId(position);
        holder.imageview.setId(position);


        holder.imageview.setImageBitmap(bitmap[position]);
        holder.checkbox.setChecked(thumbnailsselection[position]);
        holder.id = position;
        return convertView;
    }
}
class ViewHolder {
    ImageView imageview;
    CheckBox checkbox;
    int id;
}               

public Bitmap[] decodeFile(String filePath) 
{
    System.out.println("filepath in decode file .. "+filePath);
    BitmapFactory.Options o = new BitmapFactory.Options();
    o.inJustDecodeBounds = true;
    BitmapFactory.decodeFile(filePath, o);

    return bitmap;
}  

UPDATE

    Object[] values = helper.get_wbm_synccontentByEmailID(SettingConstant.EMAIL);
    count=values.length;
    this.arrPath = new String[count];
    this.thumbnailsselection = new boolean[count];
    Log.i(TAG, "values:" +values.length);
    String bImage;
    if(count>0){
        bitmap = new Bitmap [count];

        for (int i=0;i<count;i++){
            Log.i(TAG, "values[]" +values[i]);
            bImage = (String) values[i];
            Bitmap newBitmap = decodeFile(bImage);
            this.arrPath[i] = bImage;
            this.bitmap[i] = newBitmap;

        }



    public Bitmap decodeFile(String filePath) 
{
    System.out.println("filepath in decode file .. "+filePath);
    Bitmap bitmapnew = BitmapFactory.decodeFile(filePath);

    return bitmapnew;
}   
  • 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-16T01:27:20+00:00Added an answer on June 16, 2026 at 1:27 am

    Have a glance at this

    decodeFile(String filePath) returns a bitmap that is not modified in it.
    So i think the bitmap is not changing at all (just returning null).

    1. You are passing a file path and returning a bitmap array . you get a single bitmap image and passing the same as a bitmap array.

    2.Use bitmap[i] = decodeFile(bImage); instead of bitmap = decodeFile(bImage); and

    3.change return type of decodeFile(String filePath) to simply bitmap

    4.use return BitmapFactory.decodeFile(filePath,o); instead of the bitmap .

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

Sidebar

Related Questions

I'm using flex and have a few images that I need to sequence through.
I have a fair few images that I'm loading into a ListBox in my
I have a few html image tags that fill an array. On the page
I have populated an array with a few html image tags that I have
I have a few iFrames that all use a single background image. Whenever I
I have stored a few pictures using Safari's Hold + Save Image option to
I have a folder with a few background images (one.jpg, two.jpg, three.jpg) , and
i have form in drupal which uploads images and has got few checkboxes in
Currently, I have a few hundred image files, hosted in Google Drive. I wish
I have few graphic effects on image which i am able to run on

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.