I have an activity called ConvertActivity that has a button, which calls SetPrecisionActivity dialog. After the dialog is displayed and the user presses the close button, the onResume() or onRestart() of ConvertActivity is not been called. I need to do some processing after returning to the ConvertActivity.
ConvertActivity.java
public class ConvertActivity extends Activity {
private int callingActivity;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.convert_layout);
 } 
public void onClick(View view) {
switch (view.getId()) {
case R.id.setprecision:
    // show the precision screen
    SetPrecisionActivity.app_launched(this);
    break;
}
  }
}
the convert layout
  <TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:shrinkColumns="*"  
android:stretchColumns="*"
android:padding="15dp"
android:background="#ffffff">
    <Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_span="1"
    android:gravity="center_horizontal"
    android:drawableTop="@drawable/setprecision"
    android:onClick="onClick"
    android:background="@null"
    android:id="@+id/setprecision"
    android:textSize="12sp"
    android:textColor="#000000"
    android:text="@string/csetprecisionh" />
</TableRow>
the setprecisionActivity.java (which will be shown as a dialog box)
  public class SetPrecisionActivity {
  private static Spinner spinnerp;
  public static void app_launched(Activity mContext) {
    SharedPreferences prefs = mContext.getSharedPreferences("helloapp", 0);
    SharedPreferences.Editor editor = prefs.edit();
    showPrecisionDialog(mContext, editor);
    editor.commit();
}   
public static void showPrecisionDialog(final Activity mContext, final SharedPreferences.Editor editor) {
    final Dialog dialog = new Dialog(mContext);
    dialog.setTitle("Set precision ");
   // Inflate the popup_layout.xml
   LinearLayout viewGroup = (LinearLayout) mContext.findViewById(R.id.popupprecision);
   LayoutInflater layoutInflater = (LayoutInflater) mContext
     .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
   final View layout = layoutInflater.inflate(R.layout.setprecision_layout, viewGroup);
   // Getting a reference to Close button, and close the popup when clicked.
   Button close = (Button) layout.findViewById(R.id.close);
   close.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            dialog.dismiss();
        }
    });
    dialog.setContentView(layout);        
    dialog.show();        
}
 }
 
     
     
    