Read the thread friend.
My following blocks work without problems on one screen but when I replicate them on another I get an error.
Attempting to call virtual method ‘android.graphics.Bitmap android.graphics.drawable.BitmapDrawable.getBitmap ()’ on a null object reference
It only fails when printing via Bluetooth, the path is correct, the file is created and exists, I can share it, but not print.
I tried with several names, also previously deleting the file and nothing works
Ask for permission in Screen 1 and do it as shown here
Taifun
I have no permission problems, the connection is established without problems, the problem is in selecting the image, in the same project but another screen it works and prints, but when replicating the blocks it does not
Specifically, the problem is at this point, however the File_Path is correct, in fact if I use share the file is attached
Remove those permission blocks then, they do not make sense
Use Do it to debug your blocks
Does the ThermalPrinting.Image method return a list?
Taifun
When calling this block it should return a list of bytes, it converts the image into bytes, the error indicates that the File_Path reference is empty, which is not the case because I did a debug and it has a path value, the image exists.
I think the problem occurs because I imported the blocks from an image, I am going to try to create them again manually. Notice that the texts and others will not look normal, like they exceed the lengths of the blocks or something like that
I rebuilt all the blocks and it still fails, above you can see the path file of the image.
I don’t understand it, on another screen everything works perfectly
Do you like to share a screenshot of the relevant blocks of the working screen including a Do it result of the filename?
Taifun
These are the ones on the other screen that do work.
It’s practically the same procedure.
both screens show the same path of the image
The author of the extension @mmnettime might wamt to provide some support…
Taifun
PS: I now moved your thread into the correct topic
Waiting for the developer @mmnettime to respond, it could take weeks or months, we don’t know, but I leave some additional information
- extension version: V4
- ComponentToImage extension works: Yes
- The image is created from the view (Layout): Yes
- Image is accessible: Yes
- On a screen with the same block it works: Yes
- The file_path variable is empty: No
- Both jpg and png were tested: Yes
- Different widths tested: Yes
- Bluetooth connection established: Yes
- cache and previous files were deleted: Yes
- If the image (file_path) is attempted to be shared, it is attached: Yes
If the image (file_path) is tried to print, an error appears:
Result: Attempting to call virtual method ‘android.graphics.Bitmap android.graphics.drawable.BitmapDrawable.getBitmap()’ on a null object reference
Hi @Gaston definitely the extension is not getting access to the image, may be because permissions or something else. If possible send me your .aia so i can help you out.
Hello, my relevant blocks, referring to the process, are the ones published, on another screen I use practically the same ones, without special permissions other than Bluetooth and it works fine.
The image is stored in ASD, if I load it in an image component it loads, if I attach it to share it does too.
Let me understand.
- You convert a component to an image in Screen 1.
- You can access that image through image and share components in Screen 1
- You go to Screen 2
- You still can access the image through the components on Screen 2 but you cannot print it.
On screen1 I only have a login interface, on screen2 it is the problem and on screen3 everything works fine.
From both screen2 and screen3 I can access the created images, if I load them in an image component, the components to check files and paths return true.
What happens is really very strange, yesterday I spent all day looking for the problem and I still couldn’t solve it.
Here is an example, generates the image, returns the path, loads it in an image1.picture
That in fact is very weird. Could be something related to blocks but is hard to tell if i couldn’t access the project to do a complete debug.
I tried to replicate this scenario and i have a similar error in fact, when the extension can’t access the image. But it makes no sense that the extension can get the image in one screen but not in another.
If you know how to use adb logcat to debug the app. PM me and we can figure this out.
I kept testing, deleted the extension, reloaded it, and everything remains the same, screen 3 without problems, we continue by DM