XML代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:background="#ffffff"
android:layout_width="match_parent" android:layout_height="match_parent">
<LinearLayout android:layout_width="fill_parent"
android:id="@+id/feedback" android:layout_height="40dp"
android:background="@drawable/top" android:orientation="horizontal">
<Button android:id="@+id/feedback_cancle" android:layout_width="wrap_content"
android:layout_height="30dp" android:layout_marginTop="3dp"
android:text="取消" android:gravity="center" android:layout_marginLeft="10dp"
android:background="@drawable/return_press" />
<TextView android:layout_width="wrap_content"
android:layout_height="50dp" android:text="用户反馈"
android:layout_marginTop="5dp" android:layout_marginLeft="50dp"
android:textColor="#FFFFFF" android:textSize="20sp" />
<Button android:id="@+id/feedback_send" android:layout_width="50dp"
android:layout_height="30dp" android:layout_marginTop="3dp"
android:singleLine="true" android:layout_marginLeft="60dp"
android:gravity="center" android:background="@drawable/send_press" />
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content" android:orientation="horizontal">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="收件人 : "
android:textColor="#000" android:textSize="20dp" />
<EditText android:singleLine="true" android:id="@+id/reciver1"
android:enabled="false" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="mobilecloud@yeah.net" />
</LinearLayout>
<ImageView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:background="@drawable/line" />
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content" android:orientation="horizontal">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="抄送/密送 : "
android:textColor="#000" android:textSize="20dp" />
<EditText android:singleLine="true" android:id="@+id/reciver2"
android:enabled="false" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="ihope01@yeah.net" />
</LinearLayout>
<ImageView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:background="@drawable/line" />
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content" android:orientation="horizontal">
<TextView android:layout_width="wrap_content" android:layout_marginLeft="5dp"
android:layout_height="wrap_content" android:text="主题 : "
android:textColor="#000" android:textSize="20dp" />
<EditText android:singleLine="true" android:enabled="false"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="用户反馈" />
</LinearLayout>
<ImageView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:background="@drawable/line" />
<EditText android:layout_width="fill_parent"
android:layout_height="fill_parent" android:id="@+id/feedbackcontent"
android:gravity="top"/>
</LinearLayout>
JAVA代码
package cn.ihope.mozyhome.Activity;
import java.util.HashMap;
import java.util.Map;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import cn.ihope.mozyhome.service.NetService;
import cn.ihope.mozyhome.util.Cache;
public class SendFeedBackActivity extends Activity {
private Button feedBackCancleButton;
private Button feedBackSendButton;
private EditText feedContent;
private EditText reciver1;
private EditText reciver2;
private String feedBackContent;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 去除title
requestWindowFeature(Window.FEATURE_NO_TITLE);
// 去掉Activity上面的状态栏
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.feedback);
feedBackCancleButton = (Button) findViewById(R.id.feedback_cancle);
feedBackCancleButton.setOnClickListener(new FeedBackCancleButtonClickListener());
feedBackSendButton = (Button) findViewById(R.id.feedback_send);
feedBackSendButton.setOnClickListener(new FeedBackSendButtonClickListener());
feedContent = (EditText) findViewById(R.id.feedbackcontent);
reciver1 = (EditText) findViewById(R.id.reciver1);
reciver2 = (EditText) findViewById(R.id.reciver2);
loginName = Cache.user.getLoginName();
mainPath = Cache.mainPath.getMainPath();
}
class FeedBackCancleButtonClickListener implements OnClickListener{
@Override
public void onClick(View v) {
finish();
}
}
class FeedBackSendButtonClickListener implements OnClickListener{
@Override
public void onClick(View v) {
//系统邮件系统的动作为android.content.Intent.ACTION_SEND
Intent intent = new Intent(android.content.Intent.ACTION_SEND);
intent.setType("plain/text");
String[] emailReciver = new String[]{reciver1.getText().toString(), reciver2.getText().toString()};
String emailSubject = "用户反馈";
String emailBody = content.getText().toString();
intent.putExtra(android.content.Intent.EXTRA_EMAIL, emailReciver);
//设置邮件默认标题
intent.putExtra(android.content.Intent.EXTRA_SUBJECT, emailSubject);
//设置要默认发送的内容
intent.putExtra(android.content.Intent.EXTRA_TEXT, emailBody);
//调用系统的邮件系统
startActivity(intent);
}
}
}