• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Editable.getText().toString() not working

rishi360

Newbie
I'm trying to create a String and then append it to a URL. But, for some reason, the toString() method doesn't work. From what I can tell, it just gives me a blank String (there IS text in the EditText).

text = edittext.getText().toString();

Help? :/
 
Are you seeing any exceptions?

What API Level are you building for?

I just built a quick test Hello World style and the following worked fine:

Code:
EditText editor = (EditText) findViewById(R.id.EditText01);
Toast.makeText(getBaseContext(), editor.getText().toString(), Toast.LENGTH_LONG)
    .show();
 
I don't believe there are any exceptions. It just returns a blank String, as far as I can tell.

Ummm I'm not exactly sure >_< But it's Android 1.6.

Code:
text = edittext.getText().toString();
//use text to make finalTextG have "+"

googleURL += finalTextG;
guri = Uri.parse(googleURL);
Intent gintent = new Intent(Intent.ACTION_VIEW, guri);
startActivity(gintent);
EDIT: Nvm I got it working.

Code:
String text = edittext.getText().toString();
                text.replaceAll(" ", "+");
                googleURL += text;
                guri = Uri.parse(googleURL);
                Intent gintent = new Intent(Intent.ACTION_VIEW, guri);
                startActivity(gintent);
 
Try this:
Code:
googleURL += text.replaceAll(" ", "+");

That line of code should take you to your happy place...
 
Back
Top Bottom