问题描述
我不明白为什么我在使用 finish() 时不能使用完成活动;
当用户点击发布按钮时,我会将数据发送到数据库并完成活动。
但它现在不起作用。
这是我的代码
谁知道发生了什么?
private void uploadpostinfo(){
String userID = getID;
//String image = convertToString();
String imageName = statusEdit.getText().toString();
String sp2 = sp.getText().toString();
String tag = tags.getText().toString();
ApiInterface_Info apiInterface_info = ApiClient.getApiClient().create(ApiInterface_Info.class);
Call<Img_Pojo_Info> call = apiInterface_info.uploadpostinfo(imageName,userID,sp2,tag);
progressDialog.show();
call.enqueue(new Callback<Img_Pojo_Info>() {
@Override
public void onResponse(Call<Img_Pojo_Info> call,Response<Img_Pojo_Info> response) {
progressDialog.dismiss();
Img_Pojo_Info img_pojo2 = response.body();
//Toast.makeText(UploadActivity.this,"Post is Successful",Toast.LENGTH_SHORT).show();
Intent intent = new Intent(UploadActivity.this,MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent);
UploadActivity.this.finish();
}
@Override
public void onFailure(Call<Img_Pojo_Info> call,Throwable t) {
Log.d("Server Response",""+t.toString());
progressDialog.dismiss();
}
});
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)