【发布时间】:2014-03-11 11:00:20
【问题描述】:
我在TableLayout 中有一个表格,表格是从我的数据库中填写的,我想通过电子邮件发送表格输出。但是我在将表格布局转换为位图时遇到问题。这是我正在进行的最后一项活动
public class SendEmail extends Activity {
Button buttonSend;
TableLayout tableMessage;
Intent emailFinal;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sendemail);
String Orderdate = java.text.DateFormat.getDateTimeInstance().format(Calendar.getInstance().getTime());
String email = pdatabase.getPEmail();
emailFinal = new Intent(Intent.ACTION_SEND);
emailFinal.putExtra(Intent.EXTRA_EMAIL, new String[]{ email});
buttonSend =(Button) findViewById(R.id.sendEmail);
tableMessage = (TableLayout) findViewById(R.id.tableLayout1);
buttonSend.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Bitmap b = Bitmap.createBitmap( tableMessage.getWidth(),
tableMessage.getHeight(),
Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(b);
tableMessage.draw(c);
BitmapDrawable d = new BitmapDrawable(getResources(), b)
emailFinal.putExtra(Intent.EXTRA_TEXT, b);
emailFinal.setType("message/rfc822");
startActivity(Intent.createChooser(emailFinal, "Choose an Email client :"));
}
【问题讨论】:
-
请发布位图转换代码。
-
我已经编辑了我的代码
-
你有什么异常吗?
标签: android tablelayout