Я создал форму для связи с Android-приложением на панели действий, я добавил ее в свое приложение, и она открывается и выглядит отлично. Единственное, что я не могу найти, - это установить onClickListner
для кнопки отправки, чтобы после нажатия кнопки отправки сообщение из формы должно было доставить непосредственно в мой почтовый ящик. Пожалуйста, помогите, вот мой код для этого.Как установить onClickListner для связи с нами в андроид-приложении
menu_main.xml
<item
android:id="@+id/contact_us"
android:title="Contact us"
android:showAsAction="ifRoom"
android:icon="@drawable/contact_us"
/>
контакт для разметки
contact_us.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:id="@+id/contact_form_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="16dp"
android:layout_marginTop="5dp"
android:text="contact us"
android:textColor="#000000"
android:textSize="20sp"
android:typeface="serif" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:backgroundTint="@color/colorPrimaryDark"
android:hint="name"
android:inputType="textPersonName" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:backgroundTint="@color/colorPrimaryDark"
android:hint="Email"
android:inputType="textEmailAddress" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:backgroundTint="@color/colorPrimaryDark"
android:hint="phone number"
android:inputType="phone" />
<EditText
android:layout_width="fill_parent"
android:layout_height="150dp"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:backgroundTint="@color/colorPrimaryDark"
android:gravity="top"
android:hint="your Message"
android:fitsSystemWindows="true"
android:breakStrategy="balanced"
android:inputType="textMultiLine"
android:singleLine="false"
android:padding="5dp" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@color/colorPrimaryDark"
android:elevation="4dp"
android:paddingLeft="70dp"
android:paddingRight="70dp"
android:text="Submit"
android:textColor="#fff" />
</LinearLayout>
MainActivity.java
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.contact_us: {
setContentView(R.layout.contact_us);
return true;
}
}
return super.onOptionsItemSelected(item);
с этим кодом, приложение дает возможность всем клиентов по электронной почте по телефону, но то, что я хочу, а не внешних клиентов электронной почты, приложение должно иметь возможность отправлять электронную почту непосредственно из самого приложения. –