问题描述
完成活动后如何刷新片段?
当我从MapFragment打开PostActivity时,我正在编写finish并提交帖子并使用finish();。关闭PostActivity的功能,如何刷新Mapfragment?
在我的MapFragment代码中
fab.setonClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getContext(),Post.class);
startActivity(intent);
}
});
这是我的邮政编码
private void uploadImage(){
String userID = getID;
String image = convertToString();
String image2 = convertToString2();
String title = maptitle.getText().toString();
String info = mapInfo.getText().toString();
String lat = currentlat.getText().toString();
String lng = currentlng.getText().toString();
String address = currentAddress.getText().toString();
ApiInterface apiInterface = apiclient.getapiclient().create(ApiInterface.class);
Call<MapSendPost> call = apiInterface.mapSendPost(image,userID,image2,title,info,lat,lng,address);
progressDialog.show();
call.enqueue(new Callback<MapSendPost>() {
@Override
public void onResponse(Call<MapSendPost> call,Response<MapSendPost> response) {
progressDialog.dismiss();
MapSendPost img_pojo = response.body();
Toast.makeText(MapPost.this,"Successful",Toast.LENGTH_SHORT).show();
finish();
}
@Override
public void onFailure(Call<MapSendPost> call,Throwable t) {
Log.d("Server Response",""+t.toString());
progressDialog.dismiss();
}
});
}
或者当我完成活动时,如何调用片段loadMap(); ?
@Override
public void onPause() {
super.onPause();
initMap();
}
@Override
public void onResume() {
super.onResume();
loadMaps();
}
但是,它仍然无法正常工作...
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)