I am working on catalog project. MainActivity for listing product, and ViewProductActivity for view or editing product. In ViewProductActivity there is "cancel" button to just close the ViewProductActivity then return to MainActivity and also there's "delete" option menu to delete my product from Database. If i click cancel button it works with no problem and MainActivity's onResume method is called. But when i click 'detele' option menu, after deletion process, app will return to MainActivity. But the problem is MainActivity's onResume not called at all. I've ensure it using Log. 

I've look at [this](https://stackoverflow.com/questions/19850099/android-onresume-not-called-after-finish-command-on-different-activity) and other threat but didn't get the answer
Here's the piece of the code.

**MainActivity's**

```
@Override
protected void onResume() {
    super.onResume();
    Log.i("zihad", "onResume");
    if (isInternetAvailable()) {
        myCatalogData.arrayAdapterAllData(myListAdapter);
    } else {
        Toast.makeText(this, "No internet connection", Toast.LENGTH_SHORT).show();
    }
}

```

**ViewProductActivity**

```
btCancel.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        finish();
    }
});

requestQueue = Volley.newRequestQueue(this);
CatalogDataHelper myCatalogData = new CatalogDataHelper(this, requestQueue);

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.action_delete) {
        new AlertDialog.Builder(this)
                .setTitle("Confirmation")
                .setMessage("Do you really want to delete this product?")
                .setIcon(android.R.drawable.ic_dialog_alert)
                .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        if (isInternetAvailable()) {
                            myCatalogData.deleteProduct(String.valueOf(idProduct));
                        } else {
                            Toast.makeText(ViewProductActivity.this, "No internet Connection", Toast.LENGTH_SHORT).show();
                        }
                    }})
                .setNegativeButton(android.R.string.no, null)
                .show();
        return true;
    }
    return super.onOptionsItemSelected(item);
}

```

**CatalogDataHelper**

```
public CatalogDataHelper(final Activity activity, RequestQueue requestQueue) {
    this.activity = activity;
    this.requestQueue = requestQueue;
}
public void deleteProduct(final String id) {
    final ProgressDialog progressDialog = ProgressDialog.show(activity, "Deleting product", "Please wait ...");
    StringRequest myStringRequest = new StringRequest(Request.Method.POST, MainActivity.URL_SERVER + "/deleteproduct.php",
            new Response.Listener<String>() {
                @Override
                public void onResponse(String jsonResponse) {
                    progressDialog.dismiss();
                    try {
                        JSONObject jObject = new JSONObject(jsonResponse);
                        if (jObject.getBoolean("success")) {
                            Toast.makeText(activity, "Product has been deleted", Toast.LENGTH_SHORT).show();
                            activity.finish(); //close ViewProductActivity and return to MainActivity
                        }
                    } catch (JSONException e) {
                        Toast.makeText(activity, "Server error", Toast.LENGTH_SHORT).show();
                        e.printStackTrace();
                    }
                }
            },
            new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    progressDialog.dismiss();
                    show_error(error);
                }
            }) {
        @Override
        protected Map<String, String> getParams() throws AuthFailureError {
            Map<String, String> mapParam = new HashMap<>();
            mapParam.put("id", id);

            return mapParam;
        }
    };
    requestQueue.add(myStringRequest);
}

```