I am developing an android application. In that application I have some variety of products.
When user clicks on any product it will show images of the product. In that page only I have
one Button like Enquiry. When user clicks on that it will open a form page . In that form I have one field Product name. After completing this when user clicks on submit the details has been mailed to admin mail .
What I want is when user clicks on Enquiry Button it should open a form page with auto filled
product name .
Here is my code.
Lenovo.java:
Button order = (Button) findViewById(R.id.order);
order.setOnClickListener(new OnClickListener(){
public void onClick(View view){
Intent intentmenu = new Intent(view.getContext(),Order.class);
startActivityForResult(intentmenu,0);
}
});
}
Order.java:
final EditText name = (EditText)findViewById(R.id.username);
final EditText mail = (EditText)findViewById(R.id.email);
final EditText phone = (EditText)findViewById(R.id.phone);
final EditText product = (EditText)findViewById(R.id.product);
final String _name = name.getText().toString();
final String _mail = mail.getText().toString();
final String _phone = phone.getText().toString();
final String _product = product.getText().toString();
System.out.println(_name);
System.out.println(_mail);
System.out.println(_phone);
System.out.println(_product);
Button email = (Button) findViewById(R.id.Button01);
email.setOnClickListener(new OnClickListener(){
public void onClick(View v){
StringBuilder body = new StringBuilder();
body.append("Name: "+name.getText().toString());
body.append("\n\n\nMail: "+mail.getText().toString());
body.append("\n\n\nPhone: "+phone.getText().toString());
body.append("\n\n\nProduct: "+product.getText().toString());
Intent i = new Intent(android.content.Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_EMAIL ,new String[]
{"b.gadwantikar1@gmail.com","",});
i.putExtra(android.content.Intent.EXTRA_SUBJECT, "Customer Details");
i.putExtra(android.content.Intent.EXTRA_TEXT, body.toString());
startActivity(i);
finish();
}
});
}
}
If any body knows then help me out…
Thanks in Advance…
You can do as below:
like the following:
and to retrive the data that already trsansfered to the new activity by doing: