Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 21    Views: 44

NicoRacing
Lost but trying
Profile
Posts: 78
Reg: Oct 25, 2013
Hyeres
3,680
01/05/15 10:13 PM (9 years ago)

pdf plugin - image background bug - android

Hi all, This is a little bug I've had in my apps for a while, concerning the appearance of background image in the pdf plugin screen. Now that I have a little time I'd like to find a solution. It's not so easy to describe the bug but it's easy and fast to reproduce. For those happy nterested souls, please download the free android app MOTORCYCLE VOCABULARY LIGHT https://play.google.com/store/apps/details?id=com.motorcyclevocabularylight Each tag in the menu opens a screen that calls up the pdf plugin. For each screen, a background image is associated : engine, chassis electrics, hardware, credits. You should see all of them without problem. To reproduce the bug it is simple : go on any screen but the first one (engine), for example go on the chassis screen. Then close the app, and re-open it. It will re-open directly on the chassis screen, with the same image in the background. But now go back to the engine screen and the associated background image won't appear (white background). Any other page works fine but the engine one. Now if you close the app while being on the engine screen, and re-open the app again, the engine backgroung image shows up again. Any idea of stuff to try ? FYI, I'm not an encoder. It took me serious time to get my head around the whole thing to just make that simple app, but hopefully i can dig in again enough to make it work right. Love Buzztouch. If it allows people like me to make an app, then it means it works brilliantly ! Very impressive. Thank you guys.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
01/06/15 12:02 AM (9 years ago)
Hi Nicholas, Very nice app! I love the icon for the app...very clean and unique. And the information in the app is top notch! I attached my device, a Nexus 7 tablet, to Eclipse and ran your app so I could see what LogCat was showing. There's nothing in there indicating why the background image goes missing from time to time. I also checked your BT_Config.txt file to see if anything was amiss there, but all looks well. So, unfortunately, I don't have any idea why this issue is happening. But I'll ping David Book, the founder of Buzztouch, and see if he has an opinion. I did notice that you haven't specified a background image for large devices in your "Electrics and Electronics" page. There's only one specified for small devices. Hopefully David can weigh in on this problem sometime soon. But, aside from that, it looks great! Mark
 
NicoRacing
Lost but trying
Profile
Posts: 78
Reg: Oct 25, 2013
Hyeres
3,680
like
01/06/15 12:20 AM (9 years ago)
Mark, A big thank you for your input and comments. You're right, I will add the electronic picture for big devices, well spoted. David is also I believe the creator oif the pdf plugin. His input would be warmly welcomed. Cheers Mark, thanks again. Nico
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
01/06/15 02:15 AM (9 years ago)
Hi guys... Seems like a fun exercise. Kidding of course. I'll fetch this uber-cool motorcycle app tomorrow (Tuesday) and get some test done like you've both already done. The LogCat may or may not help us but for sure the place the start. Sounds like @GoNorthWest has already done this and didn't find any clues. Good and bad I suppose. Without looking I'll be the onCreate / onPause / onStart / onResume lifecycle events are freaking something out? Hmm...also...any idea how large the image for the background is? Large as in it's physical dimension (like 1200x600) and also what it's file size is? Like 1mb. I'm asking as I ponder what may be happending. Android could be killing this image when the screen pauses to manage memory? Again, just a hunch... More after I tinker a bit...stay tuned until tomorrow sometime West Coast PST
 
NicoRacing
Lost but trying
Profile
Posts: 78
Reg: Oct 25, 2013
Hyeres
3,680
like
01/06/15 05:17 AM (9 years ago)
Hi David, thank you very much for taking the time. Here are the background images sizes (all jpegs): engine : 552x503 88,2 kB chassis : 955x714 75,8 kB elec : 861x384 62,6 kB hardware : 1000x876 61,7 kB credits : 546x506 13,4 kB So not so much difference but still, the engine one being the heaviest file, I tried a smaller version (24 kB) via the URL option in the pdf page background image section. No difference I'm afraid. I put it back the way it was. My feeling is that it is not related to the image itself but to the fact that it is the first tongle in the menu. I don't know if it could be an "interference" between the pdf pluggin and the menu itself, with the first tongle being coded differently than the others (since the others are optional but you must have at least the first tongle in a menu...) ? Understanding nothing about coding, I'm not able to evaluate that. And it may be a cheap analysis. Cheers ! Nico
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
01/06/15 09:19 PM (9 years ago)
@NicoRacing. OK, looking at your app on my device (from the app store). Reproduced the issue no problem. Cool app by the way! I'm running a Nexus 7 tablet if it matters. All works nice except the bug you describe. White as heck! When I launch the app I see the tabs along the bottom. Can I assume this is a BT v2.0 project? It's worth asking because folks do all sorts of crazy stuff after downloading the code. LOL. So, assuming v2.0... I'm guessing a bit here so bear with me, tinker a bit yourself after reading my remarks, OR SEND ME THE ENTIRE PROJECT in .zip format and I'll get a more precise look. I'm david at buzztouch.com All the plugins trigger the same method to load background images. In this case, it's the BT_screen_pdfDoc that we're interested in. Open that file.... Scroll down to about line 90 and find this line: if(backgroundImageWorkerThread == null){ Comment that line out, and the matching closing curly brace on line 93. This... if(backgroundImageWorkerThread == null){ backgroundImageWorkerThread = new BackgroundImageWorkerThread(); backgroundImageWorkerThread.start(); } becomes //if(backgroundImageWorkerThread == null){ backgroundImageWorkerThread = new BackgroundImageWorkerThread(); backgroundImageWorkerThread.start(); //} Build and run and see what happens. This simple test is an attempt to see if the "backgroundImageWorkerThread" == null. Null as in nothing, nada, doesn't exist. It should == null always when the screen loads and therefore load the background art. However, my hunch is that Android and it's latest greatest logic is hanging onto this object (the backgroundImageWorkerThread is an object) on the first tab for the app. This test may confirm this. We're saying "Hey android, do this everytime" when we comment out those lines. I think the biggest challenge here is the idea that we're mixing NEW android operating system behaviors with super-old Android logic. This code was written a few years ago and things move fast! LOL. See if commenting that out works, send me your entire project if you can, we'll go from there. We'll figure this out, it's just code! :-) d.
 
NicoRacing
Lost but trying
Profile
Posts: 78
Reg: Oct 25, 2013
Hyeres
3,680
like
01/08/15 12:55 AM (9 years ago)
dear David, your last comment showed me that maybe something big is missing in my encoding. When using the pdf plugin, I copied the file bt_screen_pdfDoc / source-android / screen_pdfdoc.xml in Eclipse in res/layout. However I did NOT copy the java file BT_screen_pdfDoc, in which you mention those lines. So I guess I have to ? So I tried to copy it in assets/BT_Docs. It raised some errors in the first screen_pdfdoc.xml file. Those erros are linked to the word xmlns in 4 lines such as : <Button xmlns:android="http://schemas.android.com/apk/res/android" I'm gonna try to play around with this until I can run it and check if that changes anything. Right now those errors prevent me from running it. I'd be happy to send you my apk file, the one that's on google play, or any other file, but how do I add a file in that discussion ? Cheers Nico
 
NicoRacing
Lost but trying
Profile
Posts: 78
Reg: Oct 25, 2013
Hyeres
3,680
like
01/08/15 01:08 AM (9 years ago)
I actually just had to clean the project to solve the errors... So I ran the project with the BT_screen_pdfDoc as such in the assets/BT_Docs folder. Didn't change a thing. Then I tried your idea to comment those lines out, and unfortunately it didn't work either.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
01/08/15 09:41 AM (9 years ago)
Hi Nico, I'm slightly confused about something. You mention copying the files to various folders. If you select that plugin when you prepare your project files for download, you shouldn't have to copy anything anywhere. It'll all go where it's supposed to. My advice is, when preparing your project for download, that you select ALL the plugins you own, whether you think you'll need them or not. That way, they're all there, and you can add them via the control panel at your leisure and not have to worry about downloading the package again. If you are going to include PDF files with your app, then they go in the assets > BT_Docs folder. Hope this helps! Mark
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
01/08/15 11:04 AM (9 years ago)
@GoNorthWest. Yes, I agree, something strange about the project. Looks like @NicoRacing is still unsure where things go. Normal for the uninitiated. However, he has an app in Google Play so surely there is a running project on his machine somewhere :-) @NicoRacing: To be clear. .java files go in the /src folder, .xml files go in the layout folder. Each plugin has one .java file and one .xml file. These must be in the right place in your project or it wouldn't run at all. Sending me the project is not sending me the compiled .apk file that goes on devices. Sending me the project is sending me the entire project in a .zip file. This is can be downloaded from your control panel. The idea is that I need the entire project so I can open in on my machine in Eclipse, compile it, then run it. This will allow me to "hack around" a bit to see what's happening :-)
 
NicoRacing
Lost but trying
Profile
Posts: 78
Reg: Oct 25, 2013
Hyeres
3,680
like
01/08/15 11:42 AM (9 years ago)
Hi guys, @Mark you're absolutely right, and I think that's how it was done initially, about 1 year and a half ago. But I made some a note for myself that I had copied the pdf.xml file afterward and I can't remember why. Maybe for an update since then I didn't have to compile the whole project again (and then have to add all the pictures, modidy the buttons labels etc.). Not too sure, it's a while ago and since I don't use this stuff with ease, I have forgotten since. I guess I'm more confused than you then. :) I surely appreciate your comment and help. @David : frustrating to deal with uninitiated like me, hmm ?:) Imagine pulling an app, as simple as it is, when you know nothing about this stuff like I do. I lost my hair then. But it was fun ! And I'm very grateful BT exists. It changed everything for me on this little project I had. I actually commented about a topic you started about the changes you wanna make for 2015. I hope you will take my input positively. Well indeed I found that file in the /src folder as you said (I didn't put it there so surely it comes from the compiling), so I tried again to block out the lines you mentionned. Still no success. OK for the zip file; I will send also the background pictures that must be added in the drawable folder. I guess I send it at [email protected] ? Thank you for your time guys, it's very much appreciated. Nico
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
01/08/15 12:51 PM (9 years ago)
Racing dude...comments on 2015 post - SUPER POSITIVE. Good stuff. I remember starting this app / ios / compile / android stuff a bunch of years ago. What a giant pain in the ass! Geez. It's the same frustration you're feeling that compelled me to start BT in the first place. Crazy painful. Still is on most days. Both iOS and Android are nearly impossible to "understand" without a tremendous amount of work. Some of us like it and feel the joy eventually, like you did. Others give up. And so it goes...hackers unite! LOL @GoNorthWest felt many of the same pains. He's been helping folks ever since. Unreal how much time and energy he puts into trying to help ALL OF US understand more and more of the nuiances. The dudes a legend. Send that .zip to david @ buzztouch, the info address doesn't get to me. The challenge is on, I'll find this pesky background-on-tab-1-mystery-image-thing :-)
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
01/08/15 08:07 PM (9 years ago)
OK guys... @NicoRacing emailed me the entire project. I have opened it in Eclipse, compiled it, and ran it. It's running on my Nexus 7 tablet. It runs wonderful and the background image issue is NOT a problem in this running app. Or, at least I can't duplicate it like I could in the app I downloaded from Google Play. A few observations. --The project I got in the email is NOT based on the same project in the Google Play Market. The current app in Google Play is an older BT project, tabs along the bottom, etc. --The tabs in the new projects are along the top using Android built in Action Bar. This design / approach embraces Googles latest recommendations. Ultimately the behavior is similiar but the appearance is different. --Functionally there is a BIG difference between the way this newer app and the older app work. I'm speaking technically here. Nerd speak...the old project loads individual Android Activities and the new project loads individual Android Fragments. Important difference if you care to learn more about this. Else, forget it. What I would do: a) Compile THIS project using Android's 4.0 libraris and submit an update to the app store. b) Scrap the old project. Doing this doesn't require any additional work as you'll need to issue an update when you "fix" this anyway. Hope this logic makes sense.
 
NicoRacing
Lost but trying
Profile
Posts: 78
Reg: Oct 25, 2013
Hyeres
3,680
like
01/08/15 11:58 PM (9 years ago)
I don't understand; First thing i did before starting this thread was to re-compile everything (that's the file you've got), pass it through Eclipse and send myself the apk file onto my tablet Archos or my phone S3 mini. I have seen no difference, and have never seen the tabs at the top !!! And I'm sure I had the right file because I had changed the pdf button from "open pdf" to "test", this way I wasn't confused between the files. Could this come from what I select in Eclipse File/Properties/Android ? I chose Google APIs Platform 2.2 API 8. This info came from the forum I think, and this way I had all the errors clean. Otherwise I have some errors in many java files and in the Manifest. So so far even with the same file I can't see what you see. It's morning in france so I'm gonna use your night time to go deeper into this. Can't you have this BT thing work with pistons, bearings and fuel? I'd be good at it... Cheers
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
01/09/15 12:36 AM (9 years ago)
Hi Nico, Since you're new, the only version of Buzztouch that you could be using is Buzztouch v3. That requires the Android 4.0 (API 14) instead of the Google APIs for compiling. If you change that, then it should clear up some errors. Also, make sure you link in the Google Play Services Library per the instructions. Mark
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
01/09/15 01:14 AM (9 years ago)
Ah, yeah, I think this is starting to add up. Like @GoNorthWest mentioned, the Android Download (your project from your control panel) is designed to be compiled using Android 4.0 libraries. To see what libraries you're compiling a project with it's Project > Properties > Android. Compiling it with the older Android libraries explains the "tabs at the bottom" idea. There are a few other things that still don't make sense but I think it's based on the previous confusion. See if you can get it running like I have on my Nexus tabet - by compiling with Android 4.0. See the .pdf in the download, it shows you how to reference the Google Play Services library project @GoNorthWest mentions too. That confuses folks sometimes but it's not tough.
 
NicoRacing
Lost but trying
Profile
Posts: 78
Reg: Oct 25, 2013
Hyeres
3,680
like
01/09/15 01:17 AM (9 years ago)
I don't understand; First thing i did before starting this thread was to re-compile everything (that's the file you've got), pass it through Eclipse and send myself the apk file onto my tablet Archos or my phone S3 mini. I have seen no difference, and have never seen the tabs at the top !!! And I'm sure I had the right file because I had changed the pdf button from "open pdf" to "test", this way I wasn't confused between the files. Could this come from what I select in Eclipse File/Properties/Android ? I chose Google APIs Platform 2.2 API 8. This info came from the forum I think, and this way I had all the errors clean. Otherwise I have some errors in many java files and in the Manifest. So so far even with the same file I can't see what you see. It's morning in france so I'm gonna use your night time to go deeper into this. Can't you have this BT thing work with pistons, bearings and fuel? I'd be good at it... Cheers
 
NicoRacing
Lost but trying
Profile
Posts: 78
Reg: Oct 25, 2013
Hyeres
3,680
like
01/09/15 02:18 AM (9 years ago)
OK well I've adjusted all this. I set it with the Android 4.0 library (API 14) and linked to the Google Play lib as explained in the pdf. Indeed, all errors disappeared, but one in the BT_plugin_success.java . The error is on R.id.successImage in the following paragraph : //figure out what method... switch (itemId){ case R.id.successImage: this.wobbleImage(); return; } The Quickfix offers two options : rename in file or rename in workspace. What do I pick ? Seems that if I choose wrong I won't be able to change it back.
 
NicoRacing
Lost but trying
Profile
Posts: 78
Reg: Oct 25, 2013
Hyeres
3,680
like
01/09/15 02:49 AM (9 years ago)
OK well I've adjusted all this. I set it with the Android 4.0 library (API 14) and linked to the Google Play lib as explained in the pdf. Indeed, all errors disappeared, but one in the BT_plugin_success.java . The error is on R.id.successImage in the following paragraph : //figure out what method... switch (itemId){ case R.id.successImage: this.wobbleImage(); return; } The Quickfix offers two options : rename in file or rename in workspace. What do I pick ? Seems that if I choose wrong I won't be able to change it back.
 
NicoRacing
Lost but trying
Profile
Posts: 78
Reg: Oct 25, 2013
Hyeres
3,680
like
01/09/15 06:43 AM (9 years ago)
Forget that. I closed Eclipse and restarted it and now the problem is different : I have an error message saying I need to update my Android Developer Toolkit to minimum 23.0 and my current version is 22.6.2.v2014... It offres to look for an update but doesn't find anything. In the SDK manager, in Tools, the Android SDK Tools 24.0.2 is installed. So where is the missing bit ? In the workspace, the only file with erros is motorcyclevocabularylight_appDelegate.java Many erros, but I suspect everything would be sorted with the toolkit mentionned. Should be the last piece !
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
01/09/15 11:04 AM (9 years ago)
@NicoRacing: France, cool! Maybe it would be easier to just jump online in a GoToMeeting and do a screenshare? I'm happy to do this with you. My schedule is flexible so we could just choose time and get together. Expect about :30 mins. This approach may be best to getting your machine setup with what we need (Android stuff) and getting this going in the right direction. Plus, it'll be fun to hang out a bit :-) Email me as needed... david @ buzztouch.com
 
NicoRacing
Lost but trying
Profile
Posts: 78
Reg: Oct 25, 2013
Hyeres
3,680
like
01/21/15 12:55 AM (9 years ago)
Guys, the problem was actually the Android-Eclipse. Once the "standard" Eclipse installed, it went smooth.You were right GoNorthWest, the updates then cleared out the errors. I'm very happy with the new look of the app. It's a very nice plugin. Background images are stable. Sweet. I will release today or tomorrow. It's good to get there. Great feeling. The splashscreen seems to have lost itself in the process. It doesn't respect the fading transition as specified, it just bounces in and jumps onto the app without transition, no matter what I do. It's not a worry, I can live with what it does, but something to look at in the future. Also is there a way to have the "back" button on samsung phones (the physicial one, not within the app) inactive in the app ? In some not-so-common conditions it makes the thing bug a little. If it isn't, no big deal. THANK YOU A THOUSAND TIMES FOR THE TIME YOU GAVE ME, both of you, and David I'm very pleased we came to chat. You rock, and so does BT. Bonne nuit Nico
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.