का उपयोग कर उन्हें सीधे एक ईमेल पते पर भेजें, मैं वर्तमान में एक एंड्रॉइड एप्लिकेशन पर काम कर रहा हूं जिसमें ऑर्डर फॉर्म है। मैं जानना चाहता हूं कि उपयोगकर्ता को ईमेल ऐप पेज पर लाने के बिना, उपयोगकर्ता को इनपुट करने के लिए एप्लिकेशन को सीधे कैप्चर करने और बटन का उपयोग करके ईमेल पर इनपुट भेजने की अनुमति कैसे दे सकती है। मुझे पता है कि मेरी .java क्लास में त्रुटियां हैं, हालांकि, मैं कोशिश कर रहा हूं ... नीचे मेरी एक्सएमएल (लेआउट) फ़ाइल और मेरी .java क्लास फ़ाइल है। कृपया मेरी मदद करें ... धन्यवाद !!उपयोगकर्ता इनपुट कैप्चर करें और बटन
यहाँ मेरी .xml फ़ाइल (लेआउट) है
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1">
<TextView
android:id="@+id/txtname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name: "
/>
<EditText
android:id="@+id/editname"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtname"
android:hint="Your name please"
/>
<TextView
android:id="@+id/txtemail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/editname"
android:text="Email Address: "
/>
<EditText
android:id="@+id/editemail"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtemail"
android:hint="Enter email address here"
/>
<TextView
android:id="@+id/txtnum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/editemail"
android:text="Contact Number: "
/>
<EditText
android:id="@+id/editnum"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtnum"
android:hint="Enter contact number here"
/>
<TextView
android:id="@+id/txtadd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/editnum"
android:text="Mailing Address: "
/>
<EditText
android:id="@+id/editadd"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtadd"
android:hint="Enter mailing address here"
/>
<TextView
android:id="@+id/txtitems"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/editadd"
android:text="Item(s): "
/>
<EditText
android:id="@+id/edititems"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtadd"
android:hint="Enter item(s) here"
/>
<Button
android:id="@+id/btn_submit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/edititems"
android:text="Submit form"
/>
</TableLayout>
यहाँ मेरी जावा वर्ग कोड
public class OrderFormActivity extends Activity implements OnClickListener{
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.orderform);
Button btnsubmit = (Button)findViewById(R.id.btn_submit);
btnsubmit.setOnClickListener(this);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (v == this.findViewById(R.id.btn_submit)) {
EditText name = (EditText)findViewById(R.id.editname);
String strname = name.getText().toString();
EditText email = (EditText)findViewById(R.id.editemail);
String stremail = email.getText().toString();
EditText num = (EditText)findViewById(R.id.editnum);
String strnum = num.getText().toString();
EditText add = (EditText)findViewById(R.id.editadd);
String stradd = add.getText().toString();
EditText items = (EditText)findViewById(R.id.edititems);
String stritems = items.getText().toString();
showOrder(strname, stremail, strnum, stradd,stritems);
}
}
private void showOrder (String strname, String stremail, String strnum, String stradd, String stritems) {
String result = strname + stremail + strnum + stradd + stritems;
//Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
String emailAddress = "[email protected]";
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("plain/text");
intent.putExtra(Intent.EXTRA_EMAIL, emailAddress);
intent.putExtra(Intent.EXTRA_TEXT, result);
}
}
धन्यवाद एक है अग्रिम में फिर से होगा !!! : डी
एंड्रॉइड का उपयोग करें: बटन पर एक्सएमएल पर क्लिक करें और फिर बटन क्लिक के लिए एक फ़ंक्शन बनाएं। तो आपको v == ... – trgraglia
के लिए उस परीक्षण की आवश्यकता नहीं है http://stackoverflow.com/questions/2020088/sending-email-in-android-using-javamail-api-without-using-the-default-android -एप – PearsonArtPhoto
त्वरित प्रतिक्रिया के लिए सभी को धन्यवाद। -trgraglia, मुझे लगता है कि यह मुख्य समस्या नहीं है क्योंकि अब मैं जो करने की कोशिश कर रहा हूं वह सभी बटन इनपुट को केवल एक बटन की मदद से एक विशिष्ट ईमेल पते पर कैप्चर करना है। -Pearsonartphoto, उत्तर के लिए धन्यवाद, हालांकि, ऐसा करने में एक छोटा रास्ता है? क्योंकि मैंने पाया कि समाधान बहुत बोझिल .. क्षमा करें! – Winona