1.

In Oreo how you will create one Notification for receiving new message and also explain how we can add action in Notification?

Answer»

In “Contact Us” ACTIVITY I will create ONE button name as “Send Email”. Once the user clicks on this button it calls Implicit Intent with Action_Send and we will try to send an email with a SPECIFIC address. Please find my below CODE for SENDING an email to a user with an email address” test123@example.com”.

String[] TO = {               "test123@example.com "           };           Intent emailIntent = new Intent(Intent.ACTION_SEND);           emailIntent.setData(Uri.parse("mailto:"));           emailIntent.setType("text/plain");           emailIntent.putExtra(Intent.EXTRA_EMAIL, TO);           emailIntent.putExtra(Intent.EXTRA_CC, CC);           emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Your subject");           emailIntent.putExtra(Intent.EXTRA_TEXT, "Email message goes here");           try {               startActivity(Intent.createChooser(emailIntent, "Send mail..."));               finish();               Log.i("Finished sending email...", "");           } catch (android.content.ActivityNotFoundException ex) {               Toast.makeText(ContactUs.this, "There is no email client installed.", Toast.LENGTH_SHORT).show();


Discussion

No Comment Found

Related InterviewSolutions