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]
}
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]
}