Programming help with views - Android Software Development

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?

Related

[Q] Learning Loops

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

Assistance with final year college project

Hi all!
I'm in my final year and we're supposed to do a project which is worth 200 marks overall. Most of us in our field have chosen to develop either android or iphone applications. My group and I have chosen adnroid.
Now, I'm in need of simple ideas for the apps. We have absolutely no idea on how to go about with the process. I've seen lots of people here develop stunning applications here! We're in need of ideas for developing simple apps.. which can be completed in a max of 2-3 months (considering the fact that we don't have any background knowledge on android development/programming. All we know is Java)
I'd initially suggested an automatic mobile credit recharge system, where in the app monitors you prepaid account balance from time to time and recharges the account once the credit falls below a user set value.
Although this seemed interesting at first, it can only be simulated with 2 databases (one for the mobile credit and another for the bank account)
After going through the type of apps here, I really want to develop something much better than this.
I'm open to all ideas, in fact, we don't mind developing an app that is already existing (for instance a profile manager or a data wallet etc) All we want is to have a fully complete app at the end of 2 months.
Please assist.
Thanks!
Secret Santa?
That's something that I thought up over winter break and whipped it up over a few days in the App Inventor. If you guys take your time, you can probably learn Android programming and design/code it in a month or so.
There are some "special" features that I added to make the app more useful but I'll leave that for you to think up.
I'll post back if I come up with anything else. I also need some app ideas, but just for recreational programming.
Thanks! I'm currently checking out appInventer.. I somehow find it hard to come up with ideas which is why I'm trying to find help from here :|
I think the credit recharger is a pretty cool idea, personally. But I understand that you might want something with more "impact"
I think part of the key to this would be figuring out what has not already been done to death. There are so many apps with 5, 6, 7, etc versions of the basically the same thing. I would try to find something to develop with less competition, even if it's more of a niche product. I'm trying to think of the things I've previously thought "I wish I had an app for ____" but I'm drawing a blank right now.
If I think of anything I'll be sure to post it back in here
DrDubzz said:
I think the credit recharger is a pretty cool idea, personally. But I understand that you might want something with more "impact"
I think part of the key to this would be figuring out what has not already been done to death. There are so many apps with 5, 6, 7, etc versions of the basically the same thing. I would try to find something to develop with less competition, even if it's more of a niche product. I'm trying to think of the things I've previously thought "I wish I had an app for ____" but I'm drawing a blank right now.
If I think of anything I'll be sure to post it back in here
Click to expand...
Click to collapse
Thanks! I checked out google appInventer tutorials.. theres one which says "no text while driving" -- basically sends back an sms to the sender that ur driving.. It seems interesting so I'm gonna see how best i can use it and pack some more useful stuff along with it.. and see how it all works out.
The reason why I'm giving the auto recharge a back seat is because it can't be implemented in real time.. it can only be simulated in a virtual environment.
You might want to think about doing something that takes advantage of the maps api. It's easy to do but it looks impressive and might help you get high marks.
A great idea?!
Graphics artist here,
Something I just thought of and just started searching for (literally) when I came across your thread, would be: Using the phone as a touch sensitive.. control for editing software, ie photoshop or paint.net. Basically turn the phone into a touchpad control for a computer.
Just an idea!
mirrorhelix said:
Graphics artist here,
Something I just thought of and just started searching for (literally) when I came across your thread, would be: Using the phone as a touch sensitive.. control for editing software, ie photoshop or paint.net. Basically turn the phone into a touchpad control for a computer.
Just an idea!
Click to expand...
Click to collapse
This would be great! I'd definitely pay a couple/few dollars for something along these lines if it was user-friendly
Thats a really awesome idea!! Converting the touchscreen into a tablet input for PS or any other photo manipulation software.. But the problem is that I don't know where to begin! :|
This is a college project so the idea isn't to make a unique and sell-able application... it's to demonstrate that you can work as part of a team to make an application from design to completion.
I'd try and think of a fun app (i wouldnt care if it's been done 100 times before) that everyone on your team wants to contribute to. If it's unique, brilliant, if not nevermind you've got some good experience working as a team and making an android app.
I do like the sound of the phone touchpad app, it's been done on iPhone by Logitech but i've not seen something for android. If it helps, http://blog.logitech.com/2010/01/29...-touch-into-a-wireless-trackpad-and-keyboard/ .
There are a ton of them on the market: Gmote, MyRemote, UnifiedRemote, etc.
It might be a good idea to email this developers to get a better picture of what to do.
Problem is that all of those tools rely heavily on WiFi so you'll have to understand networking.
biggler said:
This is a college project so the idea isn't to make a unique and sell-able application... it's to demonstrate that you can work as part of a team to make an application from design to completion.
I'd try and think of a fun app (i wouldnt care if it's been done 100 times before) that everyone on your team wants to contribute to. If it's unique, brilliant, if not nevermind you've got some good experience working as a team and making an android app.
Click to expand...
Click to collapse
Bingo!! Which is exactly what my instructor said. I tried out the tutorials on appInventer.. I was toying with the idea of integrating more features into those itself. Is that a good idea? Although the concept is from Google, would it be ok to build on it? i'm particularly interested in "No texting while driving" and "Broadcast Hub" -- both these apps are awesome! Are there any notable features that I can add to make them better.
How about an app for the quick oil change places. It could show your last service and what was done. Show any upcoming maintenance and when your next oil change is due.
Maybe integrate Google Maps to show locations of service centers. Maybe offer a "e-coupon" if they use the app. Pretend they offer online scheduling and maybe show them "2 customers in bay, one waiting" - Estimated wait time 20 minutes" yada, yada
As an "older" programmer with 2 degrees, it's nice to see your college offering the mobile platform as a programming choice. Hell, all we got to write were COBOL and CICS mainframe applications and some semi-cool C++ projects.
Good Luck and Congratulations on getting your degree!!
What about a bluetooth hack to where u would be able to hack into someones phone and use their service for texting and calling. I heard of something like that when i was on my blackberry and was really into it. But it would be nice to get something like that on my Incredible
Sent from my ADR6300 using XDA App
I think it would be a good idea to make an app that uses an existing web api for a popular website, could be facebook, ebay(do they have an api?) etc etc.
It's a good way to learn a lot of aspects of android development, with a useful product as the outcome.
It doesn't matter if there is already an app for that site, think of a different way of using the site on the mobile, and go from there.
I would like to see a program that reads the weather API and reflects the current weather and location on the wallpaper. This app would require graphics design, code to parse the weather feed, writing to the OS. When I was on Windows Mobile there was a skin for Weather Panel that did this but with Android's live walpaper it could be really cool.
Thanks for the ideas you guys! I really appreciate it. Everything seems interesting.. but the problem is we don't know where to begin or how to go about it.
I did the broadcast hub tutorial present in the app inventer page. It turned out good. Is there any way I can add functionality to this itself?
blueren said:
Thanks for the ideas you guys! I really appreciate it. Everything seems interesting.. but the problem is we don't know where to begin or how to go about it.
I did the broadcast hub tutorial present in the app inventer page. It turned out good. Is there any way I can add functionality to this itself?
Click to expand...
Click to collapse
Do all the tutorials and learn the blocks, you can create lots of stuff. There is a app in the market that adds more features to the app inventor, app inventor extender
XDA App
A couple of suggestions:
- A chess PGN editor
- A simple picture/document management app where you take a photo using the camera, add some tags or other info, and save all details in a database. You can also provide search functionality and a viewer to retrieve pictures using the index you've built.
Sent from my SAMSUNG-SGH-I897 using XDA App
I did some homework on topics and came across this.. A multilingual speech translator.
Talk in a language, it converts the speech to text, translates that text to a target language, and reads the translated text aloud.
Is this feasible? What is the difficulty level?
Also, is it possible to develop a call blocker app? I looked around but wherever I search, I only find fully built apps but not pointers on how to go about creating one by yourself.
Please assist.

[Q] Detecting homescreen

Hey guys,
In an effort to 'hack' the Sense homescreen to use a custom launch/shortcut bar, I am creating an app that needs to know if the homescreen is currently visible. With this, I need some help.
I've been looking at four possibilities to do this:
1. constantly poll the window manager for the current activity. This works, however my battery doesn't like this and it's generally bad practice.
2. Use a widget to tell the service wether it's active. Too bad, Android doesn't seem to provide some kind of event to a widget when the homescreen is opened. Strange though, as you'd say this would be very useful when updating widgets. Am I overlooking something?
3. Watch the logcat or message broadcast. This works nicely to intercept a user moving away from the homescreen at it will output this when switching activities:
08-22 12:25:28.891: VERBOSE/HtcAppUsageStats(255): (launch app, package): (People, com.android.htccontacts)
I think I could intercept that, but then there's another problem. Pressing home broadcasts this message for com.htc.launcher, however using the back key (or even software options) to move back to the homescreen do not invoke this.
4. Intercept hardware presses. This seems rather hard when you don't want to actually do something with the presses. This combined with the above method would give me a decent way to see if the homescreen is active.
But all of those methods just don't work the way I want them to. Anyone got a clue on how to accomplish this? I don't mind if I require root access or some dirty programming, by the way. After all, it's some sort of a hack.
A push in the right direction would be very welcome
Quick kick. No one knows a solution for this?
Sent from my HTC Sensation Z710e using XDA App
If this is just for sense, have you checked the openSense sdk?
From something awesome
I haven't really looked into this, I also have no experience with widgets, but using my general knowledge in how Android works, concerning 2), does the widget not receive a visibility change? I know for LiveWallpapers there is a void VisibilityChanged(boolean visible) method that allows it to update when visible. Do Widgets not have this?
killersnowman said:
If this is just for sense, have you checked the openSense sdk?
From something awesome
Click to expand...
Click to collapse
Couldn't find the documentation of it. But it must be somewhere, this is indeed another option to look into.
Metastable said:
I haven't really looked into this, I also have no experience with widgets, but using my general knowledge in how Android works, concerning 2), does the widget not receive a visibility change? I know for LiveWallpapers there is a void VisibilityChanged(boolean visible) method that allows it to update when visible. Do Widgets not have this?
Click to expand...
Click to collapse
I've tried all the event listeners I could find in the reference. I don't remember the VisibilityChanged method thou, will look into that tonight. Otherwise I might be able to build a Live Wallpaper and hook it to a service.. Interesting
Thanks both!

Suggestions on what to include in System Check app

Dont what to call it so I dont know how to search for it, (mods, please dont ping me, I looked through the categories and figures this was the right place to post)
I'm thinking about creating an app that checks different functions to verify that they work as my first Android app. The purpose of this is that I'm constantly buying and selling phones and installing ROMs and I would like to speed up the process of checking to make sure calling works, MMS, SMS, data, SD Card, GPS... etc. I need a few suggestions if you guys would be so kind.
Suggestions on what to call it, would be great as well as what checks to put in it. This will be great to install on ROMs to make sure everything works before you take the time to restore your settings.
If you comment, please put your suggestions in List format then expound later to make them easy to read. Thanks a lot. Also, should this be a terminal script or is it better as an app. I havent jumped into development yet (I'm starting tomorrow) so I dont know which would be more suitable. Thanks for your input.
Well, if you're not sure yourself what it should be and should do, one great way is to look what open-source apps exist with similar functionality and try to extend them to your needs.
One such app is "android analyzer", you can google for it and see if it looks good for you. It is essentially a "sysinfo" style application which collects and shows all the info about the device.
Thank you. I was looking for something like this
Sent from my overclocked LG G2x

Develop an app to block launch of other apps

This is some hobby project i want to accomplish with, i have decent experience in programming java. But after quite a lot searching around and asking professors and anyone with experience in android development i got no clear vision of how this is accomplishable. The thing is, i want to develop an application that runs for a given amount of time(there´s a timer the user sets), during this given time certain applications will be blocked(or rather killed, or intents changed so they won´t even start to run). This selection will be done from a list given of third party applications installed.
As mentioned, ive searched everywhere i can, and the only leads i could ever find was the following:
1. Have continous check which kills the given application if it detects the specific applications running and will kill it. Downfall of this will be cpu-usage, optimalization and battery use. And also the device has to be rooted.
2. Have an alternative launcher, somehow this should help me a bit on the way to accomplish my goal. But here i sit thinking: Will i need to develop my own launcher to be able to succeed?
Nothing pointed me in any direction whether there are some native methods or similar in the android that perform similar tasks and how to implement it at all. Those who are saying there are plenty of applications our there similarly: No, they give you choices like block apps with a password and similar which is not what i´m after. I need some application that blocks it for the given time it´s set to(even though it is possible to go on your own in task manager and kill this application i want to develop, but that is out of the scope for now). This is to increase productivity without reaching for your cellphone all the time(yes, it might sound silly, but i´m quite sure it will help.
Any help is greatly appreciated as i´ve researched for over a month without any success.
Bring up your activity no matter which app starts. Make it a transparent activity and kill it as soon as it starts.

Categories

Resources