3 messages in com.googlegroups.android-beginners[android-beginners] Re: EditText getT...
FromSent OnAttachments
Kyle22 Apr 2008 14:27 
Dan U.22 Apr 2008 14:56 
Kyle22 Apr 2008 15:41 
Subject:[android-beginners] Re: EditText getText() to string for notification
From:Dan U. (dan.@gmail.com)
Date:04/22/2008 02:56:26 PM
List:com.googlegroups.android-beginners

Because "message" is whatever text is in the EditText whenever this bit of code runs. I assume this is ran in onCreate? Probably this is blank unless you gave it a default value. What you might try is to remove the message variable and then call text.getText().toString() in the Toast.makeText method.

On Apr 22, 2:28 pm, Kyle <xXKo@gmail.com> wrote:

Hi, I have my application set to grab the text from an EditText field, but for some reason even if I convert it "toString", the returned string always comes back blank. Here is my code:

Button button; EditText text;

button = (Button) findViewById(R.id.btnOK); text = (EditText) findViewById(R.id.txtCustomerName); final String message = text.getText().toString(); button.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { Toast.makeText(HelloWorld.this, message, Toast.LENGTH_SHORT).show(); }

});

Sorry for the bad code organization, but copy and paste didn't really work out the way I imagined, Haha. Any help would be great. Also, I tried searching, but for some reason I just can't find a solution.