Using a common dialog box, but calling different functions from diffrent activities in android
<p>In my app i have to use same dialog box on all the activities but then on to the click of button on dialog box i need to perform different operations for different activities, i have kept a common code for dialog but then how to call different functions, here is my code:</p>

<pre><code>final Dialog dialog = new Dialog(mContext,R.style.Theme_Levels);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.custom_alert);


TextView title = (TextView)dialog.findViewById(R.id.title);
title.setText("Network Error");

TextView msg = (TextView)dialog.findViewById(R.id.msg_txt);
msg.setText("The system is down, please check after some time ");

ImageView cancel = (ImageView)dialog.findViewById(R.id.cancel);
cancel.setOnClickListener(new OnClickListener(){

@Override
public void onClick(View v) {
dialog.dismiss();
}

});

TextView continue_btn = (TextView)dialog.findViewById(R.id.continue_btn);
continue_btn.setBackgroundResource(R.drawable.feedback_button_purple);
continue_btn.setText("Retry");
continue_btn.setOnClickListener(new OnClickListener(){

@Override
public void onClick(View v) {
//TODO perform different operation depending upon from where this function has been called
dialog.dismiss();
}

});


dialog.show(); 
</code></pre>
