Public Sub SaveBitmapToFile(Image As B4XBitmap, DirFolder As String, FileName As String)
Dim Out As OutputStream
Out = File.OpenOutput(DirFolder, FileName, False)
Image.WriteToStream(Out, 100, "PNG")
Out.Close
End Sub
i just want to write a launcher app. i have got all icon of apps, now need put the icons into gridview. but I use GridView.AddImage("",icon.Bitmap), show dir can not be null. so, i think that must save the icons to files. then i can use GridView.AddImage(dir,imagefile).
Dim pm As PackageManager
Dim icon As BitmapDrawable = pm.GetApplicationIcon(Application.PackageName)
ImageView1.SetBackgroundImage(icon.Bitmap)
SaveBitmapToFile(ImageView1.Bitmap, xui.DefaultFolder, "myicon.png")
or
B4X:
Dim pm As PackageManager
Dim icon As BitmapDrawable = pm.GetApplicationIcon(Application.PackageName)
ImageView1.Background = icon
SaveBitmapToFile(ImageView1.Bitmap, xui.DefaultFolder, "myicon.png")
Dim pm As PackageManager
Dim icon As BitmapDrawable = pm.GetApplicationIcon(Application.PackageName)
ImageView1.SetBackgroundImage(icon.Bitmap)
SaveBitmapToFile(ImageView1.Bitmap, xui.DefaultFolder, "myicon.png")
or
B4X:
Dim pm As PackageManager
Dim icon As BitmapDrawable = pm.GetApplicationIcon(Application.PackageName)
ImageView1.Background = icon
SaveBitmapToFile(ImageView1.Bitmap, xui.DefaultFolder, "myicon.png")
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.