我在onPostExecute(Boolean result)
方法中使用toast.Here是它的代码
@Override
protected void onPostExecute(Boolean result) {
//objAdapter = new listAdapter(ReadContactsActivity.this, items);
//listView.setAdapter(objAdapter);
dialog.dismiss();
if(result)
Toast.makeText(this, "Email was sent successfully.", Toast.LENGTH_LONG).show();
else
Toast.makeText(this, "Email was not sent.", Toast.LENGTH_LONG).show();
}
}
我收到错误“Toast类型中的方法makeText(Context, CharSequence, int)
不适用于参数(Class<ReadContactsActivity>, String, int)
”
答案 0 :(得分:3)
用于显示Toast使用以下代码。
@Override
protected void onPostExecute(Boolean result) {
//objAdapter = new listAdapter(ReadContactsActivity.this, items);
//listView.setAdapter(objAdapter);
dialog.dismiss();
if(result)
Toast.makeText(Yourclassname.this, "Email was sent successfully.", Toast.LENGTH_LONG).show();
else
Toast.makeText(Yourclassname.this, "Email was not sent.", Toast.LENGTH_LONG).show();
}
}