sanjibnanda Active Member Licensed User Longtime User Oct 5, 2012 #1 Hi, is it possible to load images from asset folder to different pages, If yes how can it be done ! your help will be useful...
Hi, is it possible to load images from asset folder to different pages, If yes how can it be done ! your help will be useful...
Erel B4X founder Staff member Licensed User Longtime User Oct 5, 2012 #2 You can load the bitmap by calling LoadBitmap(File.DirAssets, ...). Upvote 0
sanjibnanda Active Member Licensed User Longtime User Oct 9, 2012 #3 Erel said: You can load the bitmap by calling LoadBitmap(File.DirAssets, ...). Click to expand... Thanks for tip Erel, i tried some what but was not successful. Being newbie can i seek some more relevant code to start with. regards Upvote 0
Erel said: You can load the bitmap by calling LoadBitmap(File.DirAssets, ...). Click to expand... Thanks for tip Erel, i tried some what but was not successful. Being newbie can i seek some more relevant code to start with. regards
Erel B4X founder Staff member Licensed User Longtime User Oct 9, 2012 #4 Can you post your current code (the code that loads the images)? Upvote 0
sanjibnanda Active Member Licensed User Longtime User Oct 18, 2012 #5 PageTurnView with images project not working Hello Erel, I am attaching my turnPage project that crashes when i add images to pages.. the error caught is "android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views." I have tried many combinations, but all in vain.. so i am stuck. Please help me to continue with my project.. Also, how is it possible to display images on both sides of the page on wide screen. regards, sanjib nanda Attachments pageTurn.zip pageTurn.zip 46.9 KB · Views: 654 Upvote 0
PageTurnView with images project not working Hello Erel, I am attaching my turnPage project that crashes when i add images to pages.. the error caught is "android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views." I have tried many combinations, but all in vain.. so i am stuck. Please help me to continue with my project.. Also, how is it possible to display images on both sides of the page on wide screen. regards, sanjib nanda
agraham Expert Licensed User Longtime User Oct 19, 2012 #6 The error you are getting is self explanatory when you read the comments from the demo that you have left in your program at lines 69 and 70. ' The PageTurnerView events run on a separate thread to the main thread. ' They therefore must not try to manipulate GUI elements. Click to expand... The error is occurring at line 94 in your program "cnv.Initialize(Activity)". the exception is being trapped in Sub PTException at line 184 and is displayed on the GUI thread in Sub ShowPTError at line 65. Sub PageTurner_GetBitmap is not running on the GUI thread but is referencing Activity (which is a GUI element) in the Initialize argument. I don't see why you need to use a Canvas in PageTurner_GetBitmap, apparently trying to draw on the Activity background. Also, how is it possible to display images on both sides of the page on wide screen. Click to expand... You can't. Upvote 0
The error you are getting is self explanatory when you read the comments from the demo that you have left in your program at lines 69 and 70. ' The PageTurnerView events run on a separate thread to the main thread. ' They therefore must not try to manipulate GUI elements. Click to expand... The error is occurring at line 94 in your program "cnv.Initialize(Activity)". the exception is being trapped in Sub PTException at line 184 and is displayed on the GUI thread in Sub ShowPTError at line 65. Sub PageTurner_GetBitmap is not running on the GUI thread but is referencing Activity (which is a GUI element) in the Initialize argument. I don't see why you need to use a Canvas in PageTurner_GetBitmap, apparently trying to draw on the Activity background. Also, how is it possible to display images on both sides of the page on wide screen. Click to expand... You can't.
sanjibnanda Active Member Licensed User Longtime User Oct 20, 2012 #7 hello agraham, thanks for quick and helpful explanation. One more question : how can i by pass text as i want to show only images. i have noticed that if i do not put text, pagination is not initialized ( i mean where to declare total number of pages to be displayed) regards, sanjib Upvote 0
hello agraham, thanks for quick and helpful explanation. One more question : how can i by pass text as i want to show only images. i have noticed that if i do not put text, pagination is not initialized ( i mean where to declare total number of pages to be displayed) regards, sanjib
agraham Expert Licensed User Longtime User Oct 20, 2012 #8 sanjibnanda said: how can i by pass text as i want to show only images. Click to expand... Put the image on a bitmap. Upvote 0
sanjibnanda said: how can i by pass text as i want to show only images. Click to expand... Put the image on a bitmap.
Beja Expert Licensed User Longtime User Dec 22, 2013 #9 Hi Andrew, The demo was fantastic and it is just the same as those eBooks we read from Amazon.. Now may I ask for a little push with another demo with mixed contents.. just two pages, one text and the other image.. then I can build on it. Thank you in advance. Upvote 0
Hi Andrew, The demo was fantastic and it is just the same as those eBooks we read from Amazon.. Now may I ask for a little push with another demo with mixed contents.. just two pages, one text and the other image.. then I can build on it. Thank you in advance.
Beja Expert Licensed User Longtime User Dec 22, 2013 #11 In the example there is only text.. no mention as to how to to add images or how to put image on bitmap.. I don't know how to do that. I searched the tutorials and didn't find any reference either.. May be I am missing something. Thanks anyways. The View is great but the example presumes a level of knowledge on the subject. Upvote 0
In the example there is only text.. no mention as to how to to add images or how to put image on bitmap.. I don't know how to do that. I searched the tutorials and didn't find any reference either.. May be I am missing something. Thanks anyways. The View is great but the example presumes a level of knowledge on the subject.
agraham Expert Licensed User Longtime User Dec 22, 2013 #12 The example draws the text onto a Bitmap using a Canvas. It is hardly a great step to drawing an Image as well or instead. Upvote 0
The example draws the text onto a Bitmap using a Canvas. It is hardly a great step to drawing an Image as well or instead.
Beja Expert Licensed User Longtime User Dec 22, 2013 #14 Hi Andrew, Alright, I believe I spotted the place where I can put image.. Code: Copy cnv.DrawText( "The End", Width/2, 100dip, Typeface.DEFAULT, 24, Colors.White, "CENTER") This is the line I should replace, right? But now I didn't know the syntax of adding a bitmap.. is it DrawBMP() or DrawBitmap() and what are the parameters of the bitmap.. If you see this is too obvious and a waste of time to discuss it then please pardon me. Upvote 0
Hi Andrew, Alright, I believe I spotted the place where I can put image.. Code: Copy cnv.DrawText( "The End", Width/2, 100dip, Typeface.DEFAULT, 24, Colors.White, "CENTER") This is the line I should replace, right? But now I didn't know the syntax of adding a bitmap.. is it DrawBMP() or DrawBitmap() and what are the parameters of the bitmap.. If you see this is too obvious and a waste of time to discuss it then please pardon me.