• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Decoding Bitmaps

Millamber

Lurker
Dec 12, 2013
6
0
I am trying to move a set of images currently in the resources/drawable-hdpi folder to the Assets folder.

These images are copied to the private application directory when the app is installed.

When I do this the resulting image is smaller than when I had the image in the resources folder. i.e. the baked beans image is smaller than the others. If I load the baked beans images from the drawables folder it is the same size as the other product images.

I have tried to scale the image but it has no effect.

Any ideas as to what is causing this would be greatly appreciated.

public View getView(int position, View convertView, ViewGroup parent)
{

ImageView imView = (ImageView)rowView.findViewById(R.id.product_thumbnail);
ImageView imProduct = (ImageView)rowView.findViewById(R.id.product_icon);
tvName.setText((CharSequence) values.get(position).getName());

dirPath = context.getFilesDir().getAbsolutePath() + File.separator + "images" + File.separator + "products" + File.separator;
projDir = new File(dirPath);
if (!projDir.exists())
{
projDir.mkdirs();
}

if(values.get(position).getName().equals("Baked Beans"))
{
String imageName = values.get(position).getImageName();


Bitmap bitmap = BitmapFactory.decodeFile(dirPath + imageName + "_sm.jpg");
imView.setImageBitmap(bitmap);

}
else
{
int resID = context.getResources().getIdentifier("packagename:drawable/" + values.get(position).getImageName() + "_sm", null, "packagename");
imView.setImageResource(resID);
}

return rowView;[/SIZE]
}
 

Attachments

  • inconsistentProductImages.png
    inconsistentProductImages.png
    93.3 KB · Views: 57

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones