It's not a secret anymore!*
The moose likes Android and the fly likes Getting values from one Activity to the next. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Getting values from one Activity to the next." Watch "Getting values from one Activity to the next." New topic
Author

Getting values from one Activity to the next.

Patrick Mahoney
Greenhorn

Joined: Aug 12, 2011
Posts: 3
I've been working on my first Android app for a little while, and I pretty much have the user interface done. I've been very happy with my progress so far, but recently I ran into my first real problem.

I need to get these values:

and use them on the home screen part:

I'd like to be able to save the name and percent and create a new entry on a table below the buttons that will display the name and the percent. After that, I want to be able to take input from here:

And divide it amongst the categories.

Any help is much appreciated, I'm of course not looking for someone to completely do the work for me, just lend me a helping hand.

p.s. Sorry the pictures are big, didn't take the time to worry about resizing or anything like that.

p.p.s. Remember that this is my first app, and I really haven't done much programming in my life before, so please explain everything like I'm a beginner.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41600
    
  55
You can pass all kinds of information to the newly started activity along with the Intent that starts it. Check out the Intent.putExtra method.


Ping & DNS - my free Android networking tools app
Patrick Mahoney
Greenhorn

Joined: Aug 12, 2011
Posts: 3
Ulf Dittmer wrote:You can pass all kinds of information to the newly started activity along with the Intent that starts it. Check out the Intent.putExtra method.


Thanks, I did exactly that. I changed some code around in the main activity so that instead of startActivity() it is now startActivityForResult() and I now use that to get the values from two different activities. After that I use Intent.getExtra().

Thanks for your help!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting values from one Activity to the next.