eclipse - How do I add R drawable android? -
basicly question how add drawable resource r.java file in android eclipse can use code:
bytearrayoutputstream stream = new bytearrayoutputstream(); bitmap bitmap = bitmapfactory.decoderesource(getbasecontext().getresources(), r.drawable.kapschlogo); bitmap.compress(bitmap.compressformat.jpeg, 100 , stream); image myimg = image.getinstance(stream.tobytearray()); myimg.setalignment(image.middle); doc.add(myimg);
the image stored in parent project folder cant figure out how add tho te r file.
since r.java file automatically generated resources need put image file(s) under res/drawable folder , there indexed , accessible r.drawable.myimagefile
(xml) or getresources().getdrawable(r.drawable.myimagefile);
(java)
Comments
Post a Comment