我在我的代碼中使用2個alertdialogs,並且我正在嘗試處理Onclick。據我所知,我們只能使用一個Onclick作爲多個alertdialogs,但我不知道如何實現它。 這是我創造我的兩個Alertdialogers多個Alertdialog在一個Onclick
AlertDialog.Builder builder = new Builder(this);
builder.setTitle("Attention!");
builder.setMessage("Sorry, location is not determined. Please enable location providers");
builder.setPositiveButton("OK", this);
builder.setNeutralButton("Cancel", this);
builder.create().show();
同樣想爲我的第二Alertbuilder。
我沒有創建Alertdialogs的問題。我的問題是如何實現兩個或更多Alertdialogs只有一個Onclick? – choco
您需要有一個變量來確定您已經膨脹了哪個警報,從而確定您正在點擊哪個警報的按鈕。 – zgc7009