0

コードが機能していません。私を助けてください。すべて置換文字列を出力しますが、それ以上のコードは実行されていません。

これをデバッグすると、コードにエラーはありません。アラートボックスのコードが表示されます。

if(count>0)

          {
              System.out.println("replace all string name ");
                 // final Intent intent_ul=new Intent(this, UploadExcel.class);
              AlertDialog.Builder alertDialogBuilder_ue = new AlertDialog.Builder(this);            
                 alertDialogBuilder_ue.setTitle("Alert!!");
                 alertDialogBuilder_ue
                    .setMessage("Are you sure you want to Replace all the data related to this style ? ")

                    .setCancelable(false)
                    .setPositiveButton("Yes",new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog,int id) {
                             mySQLiteAdapter.openToWrite();
                              mySQLiteAdapter.delete_style_measurement(style_no);
                              Log.d("","yes click");
                              count=0;
                              mySQLiteAdapter.close();

                        }
                    })
                    .setNegativeButton("No",new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog,int id) {
                            Log.d("","No click");
                            count++;
                            dialog.cancel();
                            // startActivity(intent_ul);
                             //finish();
                        }
                    });
          }
4

4 に答える 4

1

これらの行をif条件の終わりの前に追加します

 AlertDialog alertDialog = alertDialogBuilder_ue.create();
 alertDialog.show();
于 2012-12-13T06:24:30.723 に答える
0

追加する必要があります

alertDialogBuilder_ue.show();

あなたのコードで

于 2012-12-13T06:21:05.870 に答える
0

このコードで確認してください。このコードは私のために働いています

Context context = CurrentActivity.this;
AlertDialog.Builder ad = new AlertDialog.Builder(context);
ad.setTitle("Application");
ad.setMessage("Do you want to proceed?");
ad.setPositiveButton("Yes", new OnClickListener() 
{
 public void onClick(DialogInterface dialog, int arg1) 
 {

 }
});
ad.setNegativeButton("Cancel", new OnClickListener() 
{
 public void onClick(DialogInterface dialog, int arg1)
 {

 }
});
ad.setCancelable(false);
ad.show();
于 2012-12-13T06:24:12.677 に答える
0

コードに追加alertDialogBuilder_ue.show();すると、ダイアログが表示されます。

一部の人々は、メソッドを使用できるハンドルを取得するためにを使用する必要あることを示唆しています。alertDialogBuilder_ue.create();AlertDialog.show()

どちらも可能ですが、ハンドルが必要ない場合はオプション使用する必要はありません.create()AlertDialog

于 2012-12-13T06:52:52.743 に答える