Java 如何在tabView中使用撰写电子邮件活动?
我想在选项卡活动中显示撰写电子邮件。这是我的密码Java 如何在tabView中使用撰写电子邮件活动?,java,android,android-layout,mobile,Java,Android,Android Layout,Mobile,我想在选项卡活动中显示撰写电子邮件。这是我的密码 TabHost tabHost=getTabHost(); TabHost.TabSpec spec; Intent intent; //View tabView= tabHost.getChildAt(0); //tabView.setPadding(0, 13, 0, 13); //tabView.setBackgroundColor(0xFFFFFFFF); intent=n
TabHost tabHost=getTabHost();
TabHost.TabSpec spec;
Intent intent;
//View tabView= tabHost.getChildAt(0);
//tabView.setPadding(0, 13, 0, 13);
//tabView.setBackgroundColor(0xFFFFFFFF);
intent=new Intent("com.android.phone.action.RECENT_CALLS").setClass(this,CallListActivity.class);
spec=tabHost.newTabSpec("Call").setIndicator("Call").setContent(intent);
tabHost.addTab(spec);
intent=new Intent("android.intent.action.Compose_EMAIL");
intent.setClassName("com.android.email", "com.android.email.activity.MessageCompose");
spec=tabHost.newTabSpec("Message").setIndicator("Message").setContent(intent);
tabHost.addTab(spec);
intent=new Intent().setClass(this, com.android.contacts.qs.logger.email.QsEmailLogger.class);
spec=tabHost.newTabSpec("Email").setIndicator("Email").setContent(intent);
tabHost.addTab(spec);
intent=new Intent().setClass(this,com.android.contacts.qs.logger.notification.NotificationLogger.class);
spec=tabHost.newTabSpec("Notification").setIndicator("Notification").setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(0);
此代码是生成错误。
错误为03-16 12:04:09.132:E/AndroidRuntime(312):java.lang.SecurityException:请求在进程android.process.acore(uid 10001)中运行com.android.email(uid 10011)中的代码
在选项卡按钮上单击,您可以调用一个方法
tv_email.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
sendSimpleEmail(tv_email);
}
});
这是一个用于打开撰写电子邮件窗口的方法,请在单击时调用此方法
public void sendSimpleEmail(View textView) {
try {
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
new String[] { email_add });
startActivity(emailIntent);
} catch (Exception e) {
Toast.makeText(getApplicationContext(),
"First Log in to your Email Account", Toast.LENGTH_LONG)
.show();
}
}
在应用程序清单中写下以下几行 sharedUserId参数用于在两个应用程序之间共享代码、流程和数据。 因此,这些代码将适用于这两个应用程序 并在这两个应用程序的.mk文件中写入这些行
LOCAL_CERTIFICATE := shared
我正在研究姜面包的源代码。我想调用联系人包中的MeassageCompose.java活动。我正在修改核心电子邮件功能,这就是为什么我不能使用此meassage的原因。
android:sharedUserId="android.uid.shared"
android:sharedUserLabel="@string/sharedUserLabel"
LOCAL_CERTIFICATE := shared