次のコードは、行に致命的な例外非同期タスク#2を与えますv1.setEnabled(false)
。
通話が成功するとボタンを無効にすることを意味します。前のv.setEnabled(false);
バックグラウンドタスクは正常に機能します。助けてください :(
public void onClick(View v) {
Intent intent = new Intent(DISPLAY_MESSAGE_ACTION);
//this one would work
//v.setEnabled(false);
final View v1=v;
mRegisterTask1 = new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
boolean success =
ServerUtilities.receipt (((String)v1.getTag()).substring(3),"acknowledged");
if (success) {
//this one causes Async Task exception
v1.setEnabled(false);
}
else {
}
return null;
}
@Override
protected void onPostExecute(Void result) {
mRegisterTask1 = null;
}