android - problem with bitmap not displaying image after a text -
i trying show image directly under text had retrieved file in sdcard text showing not image,
have been trying several methods non of workable
below code display them
//find directory sd card using api //*don't* hardcode "/sdcard" file sdcard = environment.getexternalstoragedirectory(); //get text file file file = new file(sdcard,"file.txt"); //read text file stringbuilder text = new stringbuilder(); try { bufferedreader br = new bufferedreader(new filereader(file)); string line; while ((line = br.readline()) != null) { text.append(line); text.append('\n'); } } catch (ioexception e) { //you'll need add proper error handling here } //find view id textview tv = (textview)findviewbyid(r.id.textview01); //set text tv.settext(text); bitmap bitmap = bitmapfactory.decoderesource(getresources(),r.drawable.icon); canvas canvas = new canvas(bitmap); canvas.drawcolor(color.black); canvas.drawbitmap(bitmap, 130, 10, null);
well, don't see anywhere in code trying set bitmap. whatever, using compounds drawables?
//find view id textview tv = (textview)findviewbyid(r.id.textview01); //set text tv.settext(text); tv.setcompounddrawableswithintrinsicbounds(null, null, null, getresources().getdrawable(r.drawable.icon));
Comments
Post a Comment