public Dialog onCreateDialog(int dialogId){
		Dialog dialog = null;
		try{
			//Log.v(TAG, "onCreateDialog() called");
			if (mManagedDialogs == null) {
				mManagedDialogs = new SparseArray<Dialog>();
			}
			switch(dialogId){
				case DIALOG_DELETE_ATTACHMENT_ID:
					dialog = new AlertDialog.Builder(mActivity)
			        .setTitle(R.string.dialog_confirmDelete)
			        .setIcon(android.R.drawable.ic_dialog_alert)
			        .setMessage(R.string.dialog_areYouSure)
			        .setPositiveButton(R.string.button_yes, new android.content.DialogInterface.OnClickListener(){ // TODO: !!! Make handler implement the DialogInterface.OnClickListener.
			    		public void onClick(DialogInterface dialog, int whichButton){
			    			try{
			    				if( whichButton == android.content.DialogInterface.BUTTON_POSITIVE){
			    					if( !CompletableUtil.delete(mActivity, mAttachmentUri) ){
			    						ErrorUtil.notifyUser(mActivity); // Error already handled, so just notify user.
			    					}
			    					// Notify the ListAdapter that it's cursor needs refreshing
			    					notifyDataSetChanged(); // TODO: !! Isn't this a hack to get around the normal observer thing? NO, not always. Sometimes data changes in the db record that the URI refers to and it isn't really a change to the attachment record.
			    				}
			    			}catch(HandledException h){ // Ignore.
			    			}catch(Exception exp){
			    				Log.e(TAG, "ERR000FD", exp);
			    				ErrorUtil.handleExceptionNotifyUser("ERR000FD", exp, mActivity);
			    			}
			    		}
			    	})
			        .setNegativeButton(R.string.button_no, null)
			    	.create();
		            mManagedDialogs.put(dialogId, dialog);
		            break;
			} 
		}catch(HandledException h){ // Ignore.
		}catch(Exception exp){
			Log.e(TAG, "ERR000FC", exp);
			ErrorUtil.handleExceptionNotifyUser("ERR000FC", exp, mActivity);
		}
		return dialog;
	}
public Dialog onCreateDialog(int dialogId){
		Dialog dialog = null;
		try{
		
			if (mManagedDialogs == null) {
				mManagedDialogs = new SparseArray<Dialog>();
			}
			switch(dialogId){
				case DIALOG_DELETE_ATTACHMENT_ID:
					dialog = new AlertDialog.Builder(mActivity)
			        .setTitle(R.string.dialog_confirmDelete)
			        .setIcon(android.R.drawable.ic_dialog_alert)
			        .setMessage(R.string.dialog_areYouSure)
			        .setPositiveButton(R.string.button_yes, new android.content.DialogInterface.OnClickListener(){
			    		public void onClick(DialogInterface dialog, int whichButton){
			    			try{
			    				if( whichButton == android.content.DialogInterface.BUTTON_POSITIVE){
			    					if( !CompletableUtil.delete(mActivity, mAttachmentUri) ){
			    						ErrorUtil.notifyUser(mActivity);
			    					}
			    				
			    					notifyDataSetChanged();
			    				}
			    			}catch(HandledException h){
			    			}catch(Exception exp){
			    				Log.e(TAG, "ERR000FD", exp);
			    				ErrorUtil.handleExceptionNotifyUser("ERR000FD", exp, mActivity);
			    			}
			    		}
			    	})
			        .setNegativeButton(R.string.button_no, null)
			    	.create();
		            mManagedDialogs.put(dialogId, dialog);
		            break;
			} 
		}catch(HandledException h){
		}catch(Exception exp){
			Log.e(TAG, "ERR000FC", exp);
			ErrorUtil.handleExceptionNotifyUser("ERR000FC", exp, mActivity);
		}
		return dialog;
	}
public dialog oncreatedialog(int dialogid){ dialog dialog = null; try{ if (mmanageddialogs == null) { mmanageddialogs = new sparsearray<dialog>(); } switch(dialogid){ case dialog_delete_attachment_id: dialog = new alertdialog.builder(mactivity) .settitle(r.string.dialog_confirmdelete) .seticon(android.r.drawable.ic_dialog_alert) .setmessage(r.string.dialog_areyousure) .setpositivebutton(r.string.button_yes, new android.content.dialoginterface.onclicklistener(){ public void onclick(dialoginterface dialog, int whichbutton){ try{ if( whichbutton == android.content.dialoginterface.button_positive){ if( !completableutil.delete(mactivity, mattachmenturi) ){ errorutil.notifyuser(mactivity); } notifydatasetchanged(); } }catch(handledexception h){ }catch(exception exp){ log.e(tag, "err000fd", exp); errorutil.handleexceptionnotifyuser("err000fd", exp, mactivity); } } }) .setnegativebutton(r.string.button_no, null) .create(); mmanageddialogs.put(dialogid, dialog); break; } }catch(handledexception h){ }catch(exception exp){ log.e(tag, "err000fc", exp); errorutil.handleexceptionnotifyuser("err000fc", exp, mactivity); } return dialog; }