android - Glass: Null pointer exception when trying to add image to Static Card -
I have a simple glass app using GDK to capture some text; Take a picture. I can easily create a LiveCard w / text & amp; Photo, however, when I try to convert live cards to a fixed card, I get a null pointer exception when I try to add the image to the image. Here is a snippet of my code. If I remove the image to add the call () it posts the card properly.
card c = new card (CompPlayerService.this); C.setText ("You" + took a photo of MyService, this.personName); Uri Uri = Uri.Paras (Paintings); C.addImage (uri); // & lt; - This NPE is Timeline Manager for Dinette (C);
When I set a breakpoint in service, I can see that the value of the picture path is not zero and when I post the picture to a live card, The same service that works fine here is an exception that I get:
02-17 15: 32: 25.049 14120-14120 / com.example.glassapp E / Android Runtimeum: Armal Exception: main java.lang.NullPointerException at android.glass.app.Card.addImage (Card.java:176)
picture path? My garbage is that you are taking a valid file system path to a valid
file:
replacing the URI.
You update: Uri.fromFile
card
class no long Instead, call the addImage
with the URI
argument instead, instead, load the image in bitmap
and call addImage (Bitmap)
.
Comments
Post a Comment