0

In short I would like to know how to do this:

Saving a canvas with all the output of label/edittext/views as an (image)file on sdcard.

Using a search function, it will catch this canvas and display it on a scrollview or listview.

I hope someone out there knows the answer or having a nice example of the code.

Thanks for now, JackD

JackD.
  • 21
  • 4

1 Answers1

0

The following code saves the canvas bitmap to a file:

Dim Out As OutputStream
Out = File.OpenOutput(File.DirRootExternal, "Test.png", False)
Canvas1.Bitmap.WriteToStream(out, 100, "PNG")
Out.Close

You can draw the views to the canvas by using Canvas.DrawDrawable with the views background.

Not sure what you mean with the search function. You can later load this bitmap and display it on a ScrollView (with an ImageView) or ListView (with AddTwoLinesAndBitmap).

Erel
  • 1,802
  • 2
  • 15
  • 58
  • You can use File.ListFiles to find all the files in a specific folder. – Erel Oct 04 '11 at 07:56
  • Thanks Erel for your answer, I'm gonna check if this what I am looking for. – JackD. Oct 04 '11 at 08:11
  • Hi Erel, I got: java.lang.NullPointerException at com.testcase.JackD.preview._btcapture_click(preview.java:296) \\ etc...etc. Do i miss something?? note: I already have a panel with labels/imageview and button – JackD. Oct 05 '11 at 12:25
  • It is better to start a new question for that. Check Project - Include Debug Information. It will give you the B4A line that raised this error. – Erel Oct 05 '11 at 12:48