The interaction between my Activities:
Click on a row in listview in listview.java >
Goes to Edit.java to edit information about that specific row >
When done editing, click button, which will finish the edit.java activity >
returns back to listview.java.
However, upon returning to listview.java FROM edit.java, it does not display the new updated information of the specific row of the listview that was previously clicked on.
Only when I leave the listview Activity and return back again, then the information is newly updated.
listview.java:
MyItems mi;
private ArrayList<SalesItemInformationLV> displayiteminfo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_sale_item);
mi = MyItems.getInstance();
displayiteminfo = mi.retrieveAllForlist(getApplicationContext());
final ArrayAdapter<SalesItemInformationLV> adapter = new itemArrayAdapter(this, 0, displayiteminfo);
final ListView listView = (ListView)findViewById(R.id.customListview);
listView.setAdapter(adapter);
// adapter.notifyDataSetChanged(); Place this code here but it does not work
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
SalesItemInformationLV saleitem2 = displayiteminfo2.get(info.position);
String namevalue = saleitem2.getItemname();
Double costpvalue = saleitem2.getCostprice();
Double sellpvalue = saleitem2.getSellingprice();
int qtyvalue = saleitem2.getItemquantity();
String datevalue = saleitem2.getDatesold();
int staffvalue = saleitem2.getStaffdiscount();
Intent myintent = new Intent(List.this, Edit.class);
myintent.putExtra("array", saleitem2);
myintent.putExtra("itemname", namevalue);
myintent.putExtra("itemcp", costpvalue);
myintent.putExtra("itemsp", sellpvalue);
myintent.putExtra("itemqty", qtyvalue);
myintent.putExtra("itemds", datevalue);
myintent.putExtra("itemsstaffdis", staffvalue);
startActivity(myintent);
}