Hi I want to refresh the list after moving from 1st activity to 2nd activity. I have tried many other ways like recreate() but that is not working for me.
I have used Intent in my 1st activity and onResume on 2nd activity, which is not working for me.
1st activity.
Intent i = new Intent(SaleOrderDetails.this,SalesOrders.class);
startActivity(i);
finish();
2nd activity
@Override
protected void onResume() {
clearList();
retrieveSalesOrder();
super.onResume();
}
public void clearList(){
searchedSaleOrder.clear();
saleOrderModelForDrafts.clear();
saleOrderModelForConfirms.clear();
saleOrderModelForCancels.clear();
saleOrderModelForFullfilments.clear();
readyForShippment.clear();
readyToPickUp.clear();
}
Whenever we intent to the activity it should refresh.
@Override
protected void onResume() {
super.onResume();
clearList();
retrieveSalesOrder();
}
public void clearList(){
searchedSaleOrder.clear();
saleOrderModelForDrafts.clear();
saleOrderModelForConfirms.clear();
saleOrderModelForCancels.clear();
saleOrderModelForFullfilments.clear();
readyForShippment.clear();
readyToPickUp.clear();
}
Use clearlist after super();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.