Hi, You are describing three tasks:
1 - handling a button click. http://developer.android.com/guide/topics/ui/ui-events.html http://developer.android.com/reference/android/view/View.html see View.setOnClickListener(android.view.View.OnClickListener) 2 - getting the value of an EditText field (the email address) http://developer.android.com/reference/android/widget/EditText.html see getText() 3 - sending the email. The code I use is:
Intent view = new Intent(Intent.ACTION_VIEW); StringBuilder uri = new StringBuilder("mailto:"); uri.append(<email address here>); uri.append("?subject=").append(Uri.encode(<subject here>)); uri.append("&body=").append(Uri.encode(<message body here>)); view.setData(Uri.parse(uri.toString())); startActivity(view);
There are other ways to specify subject and body, but this one works with certain buggy email clients (H*C Se*se).
-- Kostya 03.12.2010 14:16, saex пишет:
Hi im searching on google and here and i only find hard ways, that i can't understand, because i am starting on android. I have a textfield on my app, and a button. I only want that when user press the button, my app have to send a email with the text "Hello" to the direction on the textfield. there is a easy way to do it?
-- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en