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 <[EMAIL PROTECTED]> 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.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to