android - ImageView setImageDrawable results in a blank image being drawn -


the code in oncreate()

applicationinfo app = getpackagemanager().getapplicationinfo(getintent().getstringextra("app"), 0); ((textview) findviewbyid(r.id.textview2)).settext(app.loadlabel(getpackagemanager())); ((imageview) findviewbyid(r.id.imageview2)).setimagedrawable(app.loadlogo(getpackagemanager())); 

the image set third line should draw app icon, instead draws blank. note, app in question not app, app on phone. so, i've passed applicationinfo directly activity , through package name now, don't think that's issue. i've set dummy image in xml , commented third line , image displays correctly. doing wrong?

the xml

<imageview     android:layout_width="50dp"     android:layout_height="50dp"     android:id="@+id/imageview2" /> 

you have chosen strange way set image in opinion. have tried setting by

((imageview) findviewbyid(r.id.imageview2)).setimageresource(r.drawable.your_image_name_here) 

or

((imageview) findviewbyid(r.id.imageview2)).setbackgroundresource(r.drawable.your_image_name_here) 

?


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -