How can i create block where developer can input a image from assets?

Showing Images Is Two Possible Ways

  1. Show Image As Background Of Component
  2. Create ImageView In Component As Show it

i want this

So This Code Is For That

No, im sorry, i mean this

  1. Show Image As Background Of Component
2 Likes

I Think You Are Confuse

1 Like

no, i just lack of concentration

1 Like

@Salman_Dev is new to java that’s why he is confused.

:pensive: :rofl:

so, do you have the code for “Show Image As Background Of Component” @Srrazmi :face_with_monocle:

2 Likes

i am unable to understand why the code is not working for you. because it works fine for me.
please try again

here is my code

@SimpleFunction
public void SetupView(AndroidViewComponent layout, String image) throws Exception {
View view = layout.getView();
Bitmap bitmap = MediaUtil.getBitmapDrawable(form, image).getBitmap();
Image img = (Image) bitmap;
view.setImage(img);
}

if this code is not working for you then, you have setup appinventor sources wrongly.

1 Like

have you compiled this code ?? @Salman_Dev

why you have to use tht

first tell me you compiled this code or not ??

okay please wait

1 Like

because this statement throws Exception. So, i declared the Exception.

I don’t think that’s necessary

1 Like

you can try yourself

worked or not ??

please wait, because I am using the appybuilder code editor

1 Like