0

I am trying to display image from changing url in my code to image view. How can I convert my resource id for image view in layout to ImageView object. there is no findViewById in app widgets and RemoteViews has setImageViewResource but it accepts drawables only and not the id's in layout xml. Guys, please please help..

ImageView logoView = new ImageView();
logoView.setImageResource(R.id.merchant_image);//this is error as this id is not in drawable but in layout.

Please please guide..

Atihska
  • 4,803
  • 10
  • 56
  • 98

1 Answers1

0

Change

ImageView logoView = new ImageView();

to

ImageView logoView = (ImageView)getView()findViewById(R.id.merchant_image);

Edit :

for your warning “Class loader may fail for processes that host multiple applications”

try

Android: "Class loader may fail for processes that host multiple applications"

Community
  • 1
  • 1
Tarsem Singh
  • 14,139
  • 7
  • 51
  • 71
  • We cannot use findViewById in app widgets. – Atihska Jul 12 '13 at 18:50
  • Also, I am not updating my resource id with drawable image but by url. – Atihska Jul 12 '13 at 18:52
  • yes you can update that by url ! first get image from your url and store it to bitmap and than use : logoView.setImageBitmap(yourBitmapImageObject); – Tarsem Singh Jul 12 '13 at 18:55
  • @Atihska sorry i got you point now, its little late ! try my updated answer ! – Tarsem Singh Jul 12 '13 at 19:13
  • 07-12 12:02:12.708: W/ActivityThread(5316): ClassLoader.getResources: The class loader returned by Thread.getContextClassLoader() may fail for processes that host multiple applications. You should explicitly specify a context class loader. For example: Thread.setContextClassLoader(getClass().getClassLoader()); – Atihska Jul 12 '13 at 19:20