Using the SkeletonApp default code, how would I insert a void or whatever (sorry not knowing the terminology yet) that would run each cycle of the program like a counter or something?
Just keep it simple, just a "run this always" loop while maintaining the button functions would be great.
OR-
I did read something on the web that said Java/Android does not use a main run void() like C#,C++ and others do, but in fact it uses more than one function/class or something as it's loop.
Is that true?
I know, it's a tough one huh?
Nobody knows?
If I understand what you're saying, and I'm not sure I do, use a timer/service/new thread and update the UI from that timer/service/new thread with listeners.
Using a loop means that the program will be tied up in your loop and it will appear like your application is frozen.
So are you trying to create a loop which will run forever until a certain condition is flagged? That shouldn't be too hard to do, you'd have to create a service that does it in the background i think, so it doesn't affect anything else.
Some of my uni lecture notes have info on the different loops (while, do and do-while), they might help in some way
http://forum.xda-developers.com/showthread.php?t=854462
any chance of you guys showing me some code that will work in your basic "helloworld" app the counts from 2min to 0 or something so I can get my feeble mind around it
Related
If any of you have flashed a ROM and then promptly restored everything with TiBu, then you know the pain that is Restoring the Widgets that get the "Problem Loading Widget" error. Now you might say "You're just lazy its only 4 widgets!" Which I would reply "Yes that would be the case unless I'm a user that
1) likes widgets...a lot.
or
2)likes the WP7 theme idea...a lot.
So you see that is where this app/hack/script will come in handy.
Now I think if anyone would like to help me(I'm a complete linux noob, in fact the only thing i know how to do is a little bit of Java!) I would gladly use all the resources I can, anything from project management to learning a whole new Prog Language.
Now let's start with phase one: Identifying the problem.
My guess is that this error stems from the launcher-widget communication. The only way I can rationalize it is that the launcher requests the widget and the responsible activity can't find it. I have no clue. I'm going to go find the source code of a launcher and analyse it.
If anyone can chime in or even leave some source(s) that would be wonderful!
Thanks!
I could use some help with an app I'm working on. I need to know how to control the views and work with which things are in focus. I also want it to work even while in the background so using a handler or something else is knowledge I could use help with. I've been sifting through the javadoc and multiple other forums and am pretty much stuck. Anyone with decent knowledge that would be willing to help me out should message me. Thanks in advance.
First I would move this to the Android dev forum
Android uses Intents to display and run processes. Activities are Intents (views)that you can actually see on the screen and Services are Intents that can be run in the background.
Starting on the Android dev site is really the best place to find the answers to the problems.
That and using the Android examples that come with the SDK. Good luck and I hope you were talking about Android! XD
I was talking about android so here's what i'm trying to do. I want to take in trackball movements and pretty much make it so they don't affect my program or others. I'm not sure how to make it so that requestFocus() will take whatever view is currently on the screen, capture it, and pretty much revert right back to it if the trackball is used. I've tried a lot of different things, but I have been stuck on this forever. Anyone know how to accomplish this because for the most part I think that the trackball is not documented all that well. Any suggestions would be great!
I would look at the http://developer.android.com/guide/topics/ui/ui-events.html , onTrackballEvent(MotionEvent) . You should be able to override that in your service, and just process the motion however you want and not call super.onTrackballEvent();
The problem is that although onTrackBall does captures events, it does not capture all of them. In the docs it says that the method will handle all events not already handled by a view. So I guess my question overall is how do you do just that? Take in every trackball movement no matter what view is reading it? Whether it be another app or anything else. How would I capture the remaining movements?
So after a bit more research here's what I've come up with for what I need to do. Either access the event queue or make it so any time the trackball is used, whether on the homescreen or something else, my application will be able to take these events and manipulate then as i need to. So anyone willing to help with this? I figure I need to make a thread, but how do I get it to read in other applications readings? Is this even possible?
I have a user of my app who is having a problem running it. My code launches another activity in the same app, and he is saying it is stopping before it should & returning to the previous activity, and he doesn't see any Force Close warnings.
I have run my code in the emulator & on my phone, I can't reproduce the error. We both run Android 2.2 on our phones, his is an HTC EVO & mine is a HTC Wildfire, as far as I can tell his specs are better than mine so shouldn't cause an issue - I deliberately chose a low spec for for my dev work so the code ought to run on anything.
As a bit of an Andoid dev noob (but been coding for years), is there any easy way I can make a special build of the app to send to him that would log any errors that happen ? I'd like to get a stack dump as well if possible, as I'm not sure exactly what routine in the activity its crashing out in. The activity that crashes is Gallery with 9 images in it, he can't flick through them or select one. I'm stumped as to whats causing it, any assistance would be gratefully received.
Thanks.
Why not point to your app and let others here try it on their phones? It could simply be other apps installed on his phone interfering with your app.
Long time programmer here too and when I get to where you're at (and I"m sure you've put some hours into this LOL), I go back to STEP 1.
I comment-out any and all code but the bare minimum; break it down to the Intent, startActivity and maybe a Toast message in the second activity. Even parse down your XML files to bare minimum.
See if that works. Then, ADD BACK ONE LINE OF CODE AT A TIME Run program and make sure it works. Yeah, it's painful, but in my 20 years of coding, I've learned to put my pride aside and to not "pretend" all the code I've written is correct.
Sometimes on bigger projects, I"ll change or add a couple of lines of code, run a back up and test. Rinse and repeat LOL. That way, I know I"m only a couple of lines of code from what "used" to work.
Good Luck!
Thanks both of you.
old_dude - Its a paid app. Only £0.99 but I don't think people would pay to help me. There is a free version of the same app (with less functionality) that this guy can get to work. If your really interested the 2 versions are -
Plink Log - Free Version
Plink Log Pro - Paid version
Rootstonian - agreed thats the approach I'd normally take if I was having problems on my dev phone or the emulator. The problem is that its OK on my HTC Wildfire/Android2.2 but on this guys HTC EVO/Android2.2 its having problems. I dont really want to keep sending him .apks with 1 or 2 lines extra enabled just to see if that fixes his specific issue. I was hoping there was something I could code to catch whatever crashes the activity & log it somewhere for me to analyse. When I do PC dev work, I have a global exception handler that catches anything I dont explicitly handle, and dumps the full call stack into a Log File I can read later.
I think I'll just have to take the existing app & put loads of debug code into it to save messages into a log file & see what bits of code are being called & what isn't & then get him to email me the results.
Thanks for the ideas guys, its always useful to get input from another perspective.
Dave
Hmmmm, just discovered setDefaultUncaughtExceptionHandler - might be able to use that with printStackTrace. Sounds interesting.
I load a linked list of objects (i.e. a struct) at start of app. I want to pass the whole linked list to other Activity(s).
I can do linkListName.toArray() and pass via put.extra and re-create linked list in next Activity, but it just doesn't "feel" clean! ROFL
And most likely it's pass by value, not by reference (not sure if that makes a difference in my app yet, but I bet I'll need a pass by reference call). I've also read about Serialization and Parcels, but I think those are pass by value implementations too.
What I want to avoid is passing a linked list around my app; I would like to load it once, be able to have my custom class do whatever I need (adds, edits, deletes, moves etc.) on it.
Any ideas? I know I could probably just do everything in ONE Activity and just change my ContentViews as required, but I've read that can be troublesome. And note that I"m trying very hard to stay away from any database implementation just because I've done the database thing too many times.
TIA,
Roots
You could make the linked list protected instead of private and just pass a flag that tells your other activity to just access it via SomeActivity.myLinkedList
Protected makes the variable accessible by other classes in your package but not outside
From something awesome
And static...
From something awesome
Well ****, should have known that....THANKS! Guess my OOP is a bit rusty :-( ugh, I got it....seems to be ok...that is, I can see my methods when I do "ClassName.LinkedListName. "
Thank you so very much!!!!
Its happened to me before. Ive gotten caught up in Android Intents, Bundles, Extras, etc and was struggling to pass something till i stepped back and realized im still in Java... Its more of a mindset thing than anything else
From something awesome
08-06 15:46:27.354: INFO/System.out(408): This default is true
08-06 15:46:27.354: INFO/System.out(408): This default is false
Ha! My setter and getter methods are working across Activities! Woo Frikkn' Woo...I could send you $100 for that reply I'm so happy! Note to self: Must remember to write changes to file.
Just a note to ALL programmers, new and old: If you're trying to do something and it seems extremely difficult, you're probably doing it wrong. Go back to the basics and keep it simple stupid!
Ok, so I got an old Nook Simple Touch. In part because they can be had for such a cheap price on eBay these days and in part because they're among the few eInk based devices that run on Android and can actually be unlocked and more done with them than the manufacturers intended (I've used an old Kindle and man I hate how locked down and generally useless they are.) Actually, I was hoping I could do some neat stuff like setup daydream with weather info and a clock and all on it while the screen was "off" but I guess I forgot that this is a relatively new thing and it looks like it's based on a really really old Android version? Either way, I'm so used to CyanogenMod and its relatively near to AOSP nature that this thing is feeling horribly limiting and unpleasant to use for me.
Anyway, I've been searching around for various guides and such. I've found tools for rooting and putting the Google Market (yeesh, I forgot they used to call it "Market" ages ago.) It seems I needed to update the system to 1.1 for this (I had bootloops until I did, so clearly you have to have the right system version.) It seems there is a newer version or two beyond this though, but I didn't see root tools (I'm still hoping I can do more with this that might require root access to actually do.) Should I be updating beyond that? Namely, are there tools to actually root and all if I do?
Also, in the meantime, I'm running into troubles with the plain and simple fact that neither Google Market nor Amazon's app store installed by these tools work which may not be fixable. The thread on here says to add an account through Youtube first, then go to gmail and manually refresh over and over until it eventually crashes. After probably 15 minutes of this my hands were too tired to continue though. I just don't think it's supposed to take 15 minutes though. When I start the market it doesn't crash like that guide mentions either. Is there any other way to fix this? Is there any point? Obviously the market app is quite old, so perhaps it's simply never going to work? Is there some alternative way to find stuff that actually works on the NST? I thought to do F-Droid, but even it requires a newer SDK version apparently (I'm getting kind of curious what version of Android its base corresponds to. Does it predate 2.2? If so I may be in trouble since I don't think any of the stuff I was hoping I could put on there will go lower than 2.2.)
For this matter, is there a better way I can do stuff like loading apps? I was hoping to at least have a file manager to be able to use do stuff, but they didn't include one. I'll probably have to track down an apk. For now I'm having to actually use the network adb (I installed the version of the tools that was supposed to do adb over USB, but it doesn't even show up as an adb device at all for me to even so much as install a driver, so I guess it's not doing adb over USB as it should. The network method seems to work, though I'm not a big fan of leaving it wide open like that on principle really, yet remembering to manually change it on and off is a pain too.)
I realize this is a really old device and probably it is very limited what I can really do with it, but I was hoping I could at least squeeze a bit of use out of it. In particular, I'm going to need a much better reading app even if I use it for its intended purpose only. When I looked it up I had thought it was a close enough to stock Android that I'd be able to load up most apps I guess and I didn't think it would be so hard to even get anything on it.
Whew!
OK, let's start with basics. You didn't say how you rooted it but if you're working from 1.1 you probably are not getting the best out of the device. 1.21 is the final stock version. If you can get your NST back to stock, I would recommend doing so. Considering what you seem to have done already probably the easiest way to go is to use the NookManager route. Go here. Follow the instructions. There is info there for adding a Gapps package after rooting. But first get yourself back to 1.21 stock. Once that's done you can either use the Search Market tool from the Gapps package, or find apps on your computer and have them show up on the NST via the PlayStore, or side-load apps from the SD card or via ADB (default on that is WiFi with NookManager--you can install the ADB Konnect app and it works fine). There are plenty of alternate readers that run on the NST. I happen to like the stock reader very much, but to each his/her own.
When all that's done, everything depends on what your expectations are and what you want from your NST. There are a variety of kernals out there as well as USB host/audio mods. Although the Android system is old and the display limits what you can do, there are many apps that run well on the device and I personally get a lot of use out of mine, even more now that I have audio. Check out what I've done (second post) and look at what others have done (in the same thread).
There's a lot of good info in this forum on modifications, apps that run well (and don't) and many tips and tricks.
I think I have most of what I need with that actually, yes. I didn't realize from the guides I initially found that you could root or install third party components with a > 1.1 system version. With that stuff I do have a semi-working Google Market now and can actually install a lot more stuff than I thought. I see also my favorite reader app not only works, but apparently knows I'm running it on a device with an eInk screen and defaults to having eInk adaptations turned on.
Is there any way it can do anything like what I had sort of envisioned before btw? Eg on the screen "off" mode have some sort of thing that shows weather or news or something that updates every so often? (Nevermind the clock thing, that's probably a bad idea. I was just wondering about dedicating it to being sort of something like a clock with it plugged in all the time. Now I think maybe I can stop using my tablet for reading and use this instead.)
Nazo said:
Is there any way it can do anything like what I had sort of envisioned before btw? Eg on the screen "off" mode have some sort of thing that shows weather or news or something that updates every so often? (Nevermind the clock thing, that's probably a bad idea. I was just wondering about dedicating it to being sort of something like a clock with it plugged in all the time. Now I think maybe I can stop using my tablet for reading and use this instead.)
Click to expand...
Click to collapse
Sounds like you are having CM lockscreen widget withdrawal
Actually that seems like a job for Tasker. But it would be potentially messy. You'd need to:
1. Clear image in custom screensaver folder
2. Turn on wi-fi
3. Open weather/whatever app to update info
4. Take screenshot and save to custom screensaver folder
5. Close app
6. Turn off wi-fi
At that point when the Nook goes to sleep the info will be displayed on the lock screen. The question is whether Tasker can wake up the Nook and repeat this at desired intervals when you're not using it.
Also, have a look here for something along the same lines. Maybe you'll get an idea.
Ironically on my phone and tablet I keep it really simple. It's just that the eInk screen of the Nook can essentially be "always on" so to speak without draining the battery like mad (since it would only actually need to wake up every half hour or so for a frequent update schedule.)
But, all that said, it just doesn't sound like this is really worth all the effort. I guess I'm actually more used to newer versions of Android mostly rather than CyanogenMod specifically as they just have more power in what these things can do. With the Nook -- even unlocked and opened up -- it really sounds like the amount of time and effort required to even remotely approach such a thing is orders of magnitude higher. Well, that's fine. I had initially thought that I might maybe just use it as some sort of really neat "smart clock" type thing (at $35-ish on eBay you won't find many clocks that could come close to doing what an Android device could theoretically do) but in the end I don't think this is really all that realistic and definitely not worth the effort. On the other hand, now that I'm able to get more stuff actually running on it and open up its capabilities more I'm thinking I could maybe use this thing for something more akin to its original intended purpose: reading. From time to time I want my tablet to be able to do a bit more and I think this can do pretty well everything I care about beyond the basic reading stuff, so maybe I can stop carrying my tablet around all the time. (And for stuff like music I have a dedicated multimedia phone courtesy of eBay that's much better off really.)