Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Beginner: Email and Strings
    primarykey
    data
    text
    <p>I am creating an app that has a suggestion box. When the user inputs information into edit texts, the information is retrieved an put into a string value. The string is then put in the text of the email. However, when the email is sent, the text contains no values for the edit texts.</p> <p>Here is my code:</p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.suggestions); Spinner spinner = (Spinner) findViewById(R.id.emailArea); ArrayAdapter&lt;CharSequence&gt; adapter = ArrayAdapter .createFromResource(this, R.array.email_array, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(new MyOnItemSelectedListener()); Button send = (Button) findViewById(R.id.emailSendButton); EditText ettext = (EditText) findViewById(R.id.etEmailText); EditText returnAddress = (EditText) findViewById(R.id.etReturnAddress); String text = ettext.getText().toString(); String returnAddressText = returnAddress.getText().toString(); emailText = "\n\nArea in the Guide: " + area + "\n\nSuggestion or Comment: " + text + "\n\nReturn Address: "+ returnAddressText; send.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent emailIntent = new Intent( android.content.Intent.ACTION_SEND); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, address); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Suggestions/Comments: Black Ops 2"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailText); emailIntent.setType("text/plain"); startActivity(Intent.createChooser(emailIntent, "Send Mail")); finish(); } }); } private void showToast() { Toast.makeText(this, "Thank you. Your message has been sent.", Toast.LENGTH_SHORT).show();// TODO Auto-generated method stub } public class MyOnItemSelectedListener implements OnItemSelectedListener { public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int pos, long id) { area = areas[pos]; } public void onNothingSelected(AdapterView parent) { } } } </code></pre> <p>However, no matter what is entered, I always get blank text and null for the spinner. Any suggestions?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload