Help Return Bitmap

I'm using library return an bitmap based on some of the information I gave him

  @SimpleFunction
  public Object GetBitmap(){
    return cv.getBitmap();
  }

when i test it in textView.setText = GetBitmap;
return

android.graphics.Bitmap@842e8d9

This is because the Text property likely takes a String as input, so your bitmap object is coerced to a string by calling its toString() method, of which the default implementation just prints out the type and the location in memory.

2 Likes

I understand what you mean, but I searched a lot for a solution and didn't find any. Do you have any idea how to solve this problem?

I want to send it to an imageView I already tested it in an imageView but it didn't work so when I tested it on a textView it returned this text

And when I tried to convert it to drawable by this code

  @SimpleFunction
  public Object GetBitmap(){
    Drawable drawable = new BitmapDrawable(form.getResources(),cv.getBitmap());
    return drawable;
  }

it is return

android.graphics.drawable.BitmapDrawable@347254c

The problem is you're trying to fit a square peg into a round hole. A method like setText doesn't take a Bitmap or Drawable, it takes a string. If you want to assign a Bitmap or Drawable to something, look for a different method to use.

2 Likes

What about imageView ?

Well what do you mean by "it didn't work"? What exactly did you try?

1 Like

setText accept String which is a variable type in Java, you can use ImageView for creating an image, you can use getBitmapDrawable function from mediautil and apply that to ImageView, you can take a look into ImageView component of AppInventor for further example.

You can use google to search "android drawable on Imageview java"

But after all to understand the terminologies & syntax used in those examples, I recommend you to learn basics of Java and android

imgview.setImageDrawable(thedrawable);

Thank you
Jerin Jacob
(Getaix)[https://getaix.com]

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.