My android imageView is black no matter what -
i try display imageview app on (hopefully) defined view (xml)
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activityshowlayout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#73c310" android:orientation="vertical" tools:context=".showactivity" > <imageview android:id="@+id/mainimage" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/moodbutton" android:layout_alignparentleft="true" android:layout_alignparentright="true" android:layout_alignparenttop="true" android:layout_margin="12dp" android:background="#000" android:src="@drawable/gs_04_pic" /> <!-- ... --> and after in oncreate method on activity
@override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_show); /* ... blabla bla ... */ imageview imageview = (imageview) findviewbyid(r.id.mainimage); bitmap bitmap = bitmapfactory.decodebytearray(cream.getmedia(), 0, cream.getmedia().length); drawable draw = new bitmapdrawable(getresources(), bitmap); imageview.setimagedrawable(draw); imageview.invalidate(); } with cream.getmedia() returning valid byte[] (from database) can log giving me:
07-18 17:41:16.812: i/app(9883): byte[] is: [b@414af0b0
but @ end imageview black (no image on it) if don't run oncreate code displays resource set in xml (on black background set in xml too)
what wrong?
i run problem, in case problem came config in:
bluid.gradle
shrinkresources true it deleted files because didn't have static reference resources. (images in case)
so found article "keeping resources" in link resource shrinking
in resumen says: should make file in path "/res/raw/keep.xml"
<?xml version="1.0" encoding="utf-8"?> <resources xmlns:tools="http://schemas.android.com/tools" tools:keep="@layout/l_used*_c,@layout/l_used_a,@layout/l_used_b*"/>
Comments
Post a Comment