0

I'm following this post to create nine patch drawable at run-time. I need to save the 9patch image on the internal/external memory, so that i can easily retrieve it's URI and assign it to an ImageView for example. Does anybody know how can I achieve this?

P.S. Bitmap.compress method won't work, because it will save the image as a regular (not 9patch) png file.

P.S. I know that I can serialize generated NinePatch object and save it to a file. But this way I can't assign it to a RemoteViews object (using RemoteViews.setImageViewUri method). So I need to save it as a real nine patch image.

Community
  • 1
  • 1
Ashkan Sarlak
  • 7,124
  • 6
  • 39
  • 51

1 Answers1

0

You can store the image as Bitmap and then create a NinePatch using http://developer.android.com/reference/android/graphics/NinePatch.html#NinePatch(android.graphics.Bitmap, byte[])

Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134
  • I need to store it as a compiled nine patch. So that I can directly assign it to an ImageView (using its URI). As it's the only way to set a runtime generated nine patch on RemoteViews. – Ashkan Sarlak Dec 23 '14 at 09:30