This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Android and the fly likes Creating one's first android app Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "Creating one Watch "Creating one New topic
Author

Creating one's first android app

Ralph Ostrander
Greenhorn

Joined: Dec 09, 2012
Posts: 2
I am new to any programing this is my second program I have the Android SDK bundle.
I want to do this same thing by clicking a button.
How do you make a button execute this.
I just want it to run the top command.

Seemed like a good mission to learn. Then I just might need to learn more before I can do it.
Please be kind.

This is where i was going.
Any help would be nice.
Sorry to hijack thread.

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39478
    
  28
Welcome to the Ranch

Please don’t hijack threads, with or without apology. See what happened: you went 72 hours without a response. Please always use the code button; I have edited your code and you can see how much better it looks Unfortunately, you can also see it is incomplete and appears to stop part‑way through a line.
Is this really your second app? If so, ditch the Eclipse and use a text editor and the command line. Reserve IDEs for when you are more experienced.
It looks like code written by somebody much more experienced than second app, in which case, you can use Eclipse after all. I am not familiar with Android, but can’t see anything obviously wrong. What is going wrong? Is it something in the code you didn’t post? Give us more details and we shall see if we can’t help quicker than 72 hours
Ralph Ostrander
Greenhorn

Joined: Dec 09, 2012
Posts: 2
Thanks for the reply. It really is my after hello world I watched some tutorials on youtube.
and I got it to work thanks for your help, I wont hijack any more threads.

My AVD was set up wrong for this. What I found in case some one else is having trouble.



You can't simply run 'su' on the emulator, there's no root access by default. You'll need to install the 'su' program as well as the SuperUser.apk, and you'll have to do this each time you start the emulator unless using snapshots.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39478
    
  28
What’s su? For those of us who use *nix, su means change into superuser (=administrator) mode.
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

Campbell Ritchie wrote:What’s su? For those of us who use *nix, su means change into superuser (=administrator) mode.


It means the same thing for Android, which is a version of *nix. The superuser mode is generally disabled by default, and the SU program Ralph describes gives access to it. Note that for actual handsets to get the SU installed you generally have to ROOT your phone, which most carriers and handset makers try to prevent.


Steve
Krishna Srinivasan
Ranch Hand

Joined: Jul 28, 2003
Posts: 1844

HI,

this article may be useful for you. reply back if you have more questions.


Krishna Srinivasan
Spring Tutorials, OCAJP Mock Questions, 400+ OCPJP Mock Questions
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Creating one's first android app