1

I have an application which is some kind of MiniPaint which means I can draw images and save them to my sd-card. Now I would like to add some text options, using an XML Linear Layout. My idea is switching to an Activity with a XML view in wich I pretend to have an editText and a TextView (this will be enough to save my text) now want I want to know: How to combine my XML and just created Drawing? I'm thinking about placing an ImageView with my drawing in it which will take about 1/3 or 1/2 of the screen. But I have no idea how to load an Image from sd-card to my imageView. is it possible?

Any help will be appreciated, thanks in advance.

EDIT: This is how you do it:

setContentView(R.layout.notas);

    ivImagen = (ImageView)findViewById(R.id.ivImagen);
    myUri = Uri.parse("/sdcard/MisDibujos/Dibujo_1.png");
    ivImagen.setImageURI(myUri);

(Just in case that someone needs this)

1 Answer 1

0

On your ImageView use its setImageURI(...) method.

You'll first need to create your Uri and use parse(String uriString) where the uriString parameter is something like file://<path-to-image>

2
  • Would you give me some extra information/example? Excuse me but I don't know how to do it Feb 4, 2012 at 23:50
  • I figured it out, this helped me because I had no clue! I refered to the Uri article and understood what you were trying to tell me Feb 5, 2012 at 2:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.