Hi all,
First of all, i am old programmer but rookie android programmer. Please consider this situation.
I want to tile little background images to my activity backgrounds. I am using thedesolatedsoul's routine to tiling image from link below.
http://www.b4x.com/android/forum/threads/tiling-an-image-settiledbackground.39310/#content
It works perfect, thanks to him but i have problem. I created tabhost and attached 5 activity. I want to tile all backgrounds (5) different. I tried to set tiled backgrounds at start and right after adding tabhost1.add but it didnt worked and all tabs use same background.
Then i tried changing all tabs in code manually with tabhost1.currenttab and set background tiled image, but it didnt worked.
Then i tried to build array flag for all tabs and when user clicks one, immediately set background tile and set flag on to prevent redraw background for further clicks but it didnt worked again.
And i solved problem, when user clicks any tab, i am tiling (redrawing) image background everytime like code below;
Select Case TabHost1.CurrentTab
Case 0
BackgroundBMP = LoadBitmap(File.DirAssets, "10bgc.jpg")
SetTiledBackground(TabHost1, BackgroundBMP)
Case 1
BackgroundBMP = LoadBitmap(File.DirAssets, "red008.jpg")
SetTiledBackground(TabHost1, BackgroundBMP)
Case 2
BackgroundBMP = LoadBitmap(File.DirAssets, "bluesoft.gif")
SetTiledBackground(TabHost1, BackgroundBMP)
Case 3
BackgroundBMP = LoadBitmap(File.DirAssets, "graybrck.jpg")
SetTiledBackground(TabHost1, BackgroundBMP)
Case 4
BackgroundBMP = LoadBitmap(File.DirAssets, "12a.jpg")
SetTiledBackground(TabHost1, BackgroundBMP)
End Select
It works but everytime user clicks any tab, it redraws background and its not optimized code. It re-paints background again, again and again.
How can i tile backgrounds at start ? Any method ? Or i have to repaint activites everytime and wasting cpu ?
regards,
-said
First of all, i am old programmer but rookie android programmer. Please consider this situation.
I want to tile little background images to my activity backgrounds. I am using thedesolatedsoul's routine to tiling image from link below.
http://www.b4x.com/android/forum/threads/tiling-an-image-settiledbackground.39310/#content
It works perfect, thanks to him but i have problem. I created tabhost and attached 5 activity. I want to tile all backgrounds (5) different. I tried to set tiled backgrounds at start and right after adding tabhost1.add but it didnt worked and all tabs use same background.
Then i tried changing all tabs in code manually with tabhost1.currenttab and set background tiled image, but it didnt worked.
Then i tried to build array flag for all tabs and when user clicks one, immediately set background tile and set flag on to prevent redraw background for further clicks but it didnt worked again.
And i solved problem, when user clicks any tab, i am tiling (redrawing) image background everytime like code below;
Select Case TabHost1.CurrentTab
Case 0
BackgroundBMP = LoadBitmap(File.DirAssets, "10bgc.jpg")
SetTiledBackground(TabHost1, BackgroundBMP)
Case 1
BackgroundBMP = LoadBitmap(File.DirAssets, "red008.jpg")
SetTiledBackground(TabHost1, BackgroundBMP)
Case 2
BackgroundBMP = LoadBitmap(File.DirAssets, "bluesoft.gif")
SetTiledBackground(TabHost1, BackgroundBMP)
Case 3
BackgroundBMP = LoadBitmap(File.DirAssets, "graybrck.jpg")
SetTiledBackground(TabHost1, BackgroundBMP)
Case 4
BackgroundBMP = LoadBitmap(File.DirAssets, "12a.jpg")
SetTiledBackground(TabHost1, BackgroundBMP)
End Select
It works but everytime user clicks any tab, it redraws background and its not optimized code. It re-paints background again, again and again.
How can i tile backgrounds at start ? Any method ? Or i have to repaint activites everytime and wasting cpu ?
regards,
-said