You should return the "Text" variable you've used here not String
which is a type.
Also, by convention local variables shouldn't start with a capital,
you should use braces {}
And why is this static? As an example:
1 public static String func(){
2 text = textBox.getText().toString();
3 return text;
4 }
Bear in mind that text isn't declared here so put String at the start
of line 2 or pass as a parameter to the function . Also textBox isn't
declared so again either declare it or pass in one you have
already.
On Jun 20, 7:11 pm, Lior Weitzhandler <[email protected]> wrote:
> Hi,
> i have just recently started learning development and i want to know
> how do i create a function that returns a String.
> i know that it is simple but i cant figure it out.
>
> example:
>
> public static String func()
> Text=textBox.getText().toString();
> return String;
>
> Thank you!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en