На данный момент у меня есть кнопка, по нажатию на которую я могу делать вызов.
this.infoButtonListener = new OnInfoWindowElemTouchListener(callButton,
getResources().getDrawable(R.drawable.round_but_green_sel),
getResources().getDrawable(R.drawable.round_but_red_sel))
{
@Override
protected void onClickConfirmed(View v, Marker marker) {
Object tag = marker.getTag();
if (tag != null) {
Intent call = new Intent(Intent.ACTION_DIAL);
call.setData(Uri.parse("tel:" + String.valueOf(tag)));
startActivity(call);
}
}
};
this.callButton.setOnTouchListener(infoButtonListener);
Хочу сделать аналогично для отправки email. Перешёл к офф документации, но что то не работает( Помогите преоборазовать корректно, в AndroidManifest всё добавил
<activity ...>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<data android:type="*/*" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="mailto" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Для запуска интента, отображающего список приложений через которые можно отправить письмо используйте следующий код:
public static void sendEmail(Context context) {
Intent intent = new Intent(Intent.ACTION_SENDTO); // it's not ACTION_SEND
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT, "subject");
intent.putExtra(Intent.EXTRA_TEXT, "text");
intent.setData(Uri.parse("mailto:example@example.com")); // or just "mailto:" for blank
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); // this will make such that when user returns to your app, your app is displayed, instead of the email app.
checkAndStart(context, intent, R.string.error_send_email);
}
private static void checkAndStart(Context context, Intent intent, int errorRes) {
if (checkIntent(context, intent)) {
context.startActivity(intent);
} else {
Toast.makeText(context, context.getString(errorRes), Toast.LENGTH_SHORT).show();
}
}
Сборка персонального компьютера от Artline: умный выбор для современных пользователей