It seems that if you do not call Pager.Paginate(text) you can only get 2,3 images . How can i load many bmp's without any text ?
I have posted the following code which works (all bmp's shown) , only if you call Pager.Paginate(text)
I want to load , say 30 bmp's, with no text, how??
can someone paste some code.. Thanks !
I have posted the following code which works (all bmp's shown) , only if you call Pager.Paginate(text)
I want to load , say 30 bmp's, with no text, how??
can someone paste some code.. Thanks !
B4X:
Sub PageTurner_GetBitmap(Width As Int, Height As Int, Page As Int) As Bitmap 'Called when the Bitmap for the given page number is required. Return the Bitmap
Dim bmp As Bitmap
Dim cover As Bitmap
Dim cnv As Canvas
bmp.InitializeMutable(Width, Height) ' do this here so we have a valid return in
If Page = 0 Then
cover=LoadBitmap(File.DirAssets, "image3.jpg")
Dim DestRect As Rect
DestRect.Initialize(0dip, 0dip,Width, Height)
cnv.Initialize2(bmp)
cnv.DrawBitmap (cover, Null, DestRect)
Return bmp
Else If Page = 1 Then
cover.Initialize(File.DirAssets, "1.jpg")
cnv.Initialize2(bmp)
Dim DestRect As Rect
DestRect.Initialize(0dip, 0dip,Width, Height)
cnv.DrawBitmap (cover, Null, DestRect)
Return bmp
Else If Page = 2 Then
cover.Initialize(File.DirAssets, "2.jpg")
cnv.Initialize2(bmp)
Dim DestRect As Rect
DestRect.Initialize(0dip, 0dip,Width, Height)
cnv.DrawBitmap (cover, Null, DestRect)
Return bmp
Else If Page = 3 Then
cover.Initialize(File.DirAssets, "3.jpg")
cnv.Initialize2(bmp)
Dim DestRect As Rect
DestRect.Initialize(0dip, 0dip,Width, Height)
cnv.DrawBitmap (cover, Null, DestRect)
Return bmp
Else If Page = 4 Then
cover.Initialize(File.DirAssets, "4.jpg")
cnv.Initialize2(bmp)
Dim DestRect As Rect
DestRect.Initialize(0dip, 0dip,Width, Height)
cnv.DrawBitmap (cover, Null, DestRect)
Return bmp
Else If Page = Pager.PageCount + 1 Then
cnv.Initialize2(bmp)
cnv.DrawColor(Colors.DarkGray)
cnv.DrawText( "The End", Width/2 , 100dip, Typeface.DEFAULT, 24, Colors.White, "CENTER")
Return bmp
Else
Return Pager.GetPageBitmap(Page - 1, Colors.White)
End If
Catch
' catch and report any exceptions on the rendering thread to the main thread
PTException
End Try
Return bmp ' if we don't return something valid we will cause an exception on the rendering thread
End Sub