Football Fans: Download the 2012 Schedule App from Google Play!


Go Back   Android Forums > Android Development > Application Development > Developer 101

Developer 101 101 Tutorials



Reply
 
LinkBack Thread Tools
Old November 3rd, 2011, 09:19 PM   #1 (permalink)
New Member
 
Join Date: Oct 2011
Posts: 8
 
Device(s):
Thanks: 6
Thanked 0 Times in 0 Posts
Default Storing input as variable.

I simply want to take an input from a number type edittext, once the button is pressed, and turn that input into a variable, say X. How do I do this?

Booocubs is offline  
Reply With Quote
Sponsors
Old November 4th, 2011, 04:15 AM   #2 (permalink)
Member
 
Join Date: Aug 2010
Location: Norway
Posts: 308
 
Device(s): Samsung Galaxy Nexus
Thanks: 0
Thanked 52 Times in 51 Posts
Default

Put this inside your onClick event for the button
Code:
EditText txt = (EditText)findViewById(R.id.txt);
String number = txt.getString().toString();
__________________
Android: Personal Storage, Lars Monsen Facts(Norwegian)
miXer is offline  
Reply With Quote
The Following User Says Thank You to miXer For This Useful Post:
Booocubs (November 4th, 2011)
Old November 7th, 2011, 09:38 PM   #3 (permalink)
Senior Member
 
Join Date: Jul 2010
Posts: 977
 
Device(s): Samsung Galaxy S II, HTC Evo 4G, Amazon Kindle Fire
Thanks: 52
Thanked 199 Times in 144 Posts
Default

Simply giving you code isn't helpful to you. You need to understand why the code does what it does so that you know when and where to use it in the future.
jonbonazza is online now  
Reply With Quote
Reply

Bookmarks


Go Back   Android Forums > Android Development > Application Development > Developer 101 User CP
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -5. The time now is 08:12 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Custom vBulletin Skins by: Relivo