How to manage startActivityForResult on Android

From your FirstActivity, call the SecondActivity using the startActivityForResult() method. For example: int LAUNCH_SECOND_ACTIVITY = 1 Intent i = new Intent(this, SecondActivity.class); startActivityForResult(i, LAUNCH_SECOND_ACTIVITY); In your SecondActivity, set the data which you want to return back to FirstActivity. If you don’t want to return back, don’t set any. For example: In SecondActivity if you want … Read more

Sending Email in Android using JavaMail API without using the default/built-in app

Send e-mail in Android using the JavaMail API using Gmail authentication. Steps to create a sample Project: MailSenderActivity.java: public class MailSenderActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final Button send = (Button) this.findViewById(R.id.send); send.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { try { GMailSender sender = new GMailSender(“[email protected]”, “password”); sender.sendMail(“This … Read more

How do I send WebView display page content to email body in android? [closed]

Insted of taking the webview content as html, take a snapshot of your webview and attach the image file in your mail. Taking Web view as screen shot (Image) // image naming and path to include sd card appending name you choose for file String mPath = Environment.getExternalStorageDirectory().toString() + “https://stackoverflow.com/” + ACCUWX.IMAGE_APPEND; // create bitmap … Read more

Start and Close single Activity from BroadcastReceiver

You could try to directly kill an activity by calling a static method in that activity: Activity A should have a variable static ActivityA activityA; In onCreate state: activityA = this; and add this method: public static ActivityA getInstance(){ return activityA; } In activity B, call the fuction getInstance() ActivityA.getInstance().finish();

How to call another activity(class) from one activity? [closed]

start as: builder1.setNegativeButton(“secondact”, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub Intent i=new Intent(Current_Activity.this, FbsampleActivity.class); //or //Intent i=new Intent(getApplicationContext(), FbsampleActivity.class); startactivity(i); } }); NOTE: Do not use getBaseContext() use getApplicationContext() or Current_Activity.thisenter code here for Starting new Activity