@@ -213,19 +213,48 @@ public void run() {
213213 }
214214 }.start ();
215215 } else if (status .equals ("delete" )) {
216- showDialog (ID_DIALOG_DELETING );
217- // pop out of the detail view if on a smaller screen
218- FragmentManager fm = getSupportFragmentManager ();
219- CommentFragment f = (CommentFragment ) fm
220- .findFragmentById (R .id .commentDetail );
221- if (f == null ) {
222- fm .popBackStack ();
223- }
224- new Thread () {
216+ Thread action3 = new Thread () {
225217 public void run () {
226- deleteComment (commentID );
218+ AlertDialog .Builder dialogBuilder = new AlertDialog .Builder (
219+ CommentsActivity .this );
220+ dialogBuilder .setTitle (getResources ().getText (
221+ R .string .confirm_delete ));
222+ dialogBuilder .setMessage (getResources ().getText (R .string .confirm_delete_data ));
223+ dialogBuilder .setPositiveButton ("Yes" ,
224+ new DialogInterface .OnClickListener () {
225+ public void onClick (DialogInterface dialog ,
226+ int whichButton ) {
227+ showDialog (ID_DIALOG_DELETING );
228+ // pop out of the detail view if on a smaller screen
229+ FragmentManager fm = getSupportFragmentManager ();
230+ CommentFragment f = (CommentFragment ) fm
231+ .findFragmentById (R .id .commentDetail );
232+ if (f == null ) {
233+ fm .popBackStack ();
234+ }
235+ new Thread () {
236+ public void run () {
237+ deleteComment (commentID );
238+ }
239+ }.start ();
240+
241+
242+ }
243+ });
244+ dialogBuilder .setNegativeButton ("No" ,
245+ new DialogInterface .OnClickListener () {
246+ public void onClick (DialogInterface dialog ,
247+ int whichButton ) {
248+ //Don't delete Comment
249+ }
250+ });
251+ dialogBuilder .setCancelable (true );
252+ if (!isFinishing ()) {
253+ dialogBuilder .create ().show ();
254+ }
227255 }
228- }.start ();
256+ };
257+ runOnUiThread (action3 );
229258 } else if (status .equals ("reply" )) {
230259
231260 Intent i = new Intent (CommentsActivity .this , AddCommentActivity .class );
0 commit comments