So I know there are probably 100 threads about this topic already. Yes I tried to read them but i can't for my life understand the concept of context in Android :(
I want to call a non-static method from "MainActivity" in another activity.
This is where i try to call the non-static method in the other activity:
public void removeSelected() {
for(A4Dialogpojo item : selectedItems) {
alCustom.remove(item);
MainActivity.saveCalData(); //This line gives me the compile error
}
This is the non-static method in MainActivty that i want to call from the other activity:
public void saveCalData(){
SharedPreferences sharedPreferences = getSharedPreferences("shared preferences", MODE_PRIVATE);
SharedPreferences.Editor editor9 = sharedPreferences.edit();
Gson gson = new Gson();
String json = gson.toJson( HomeCollection.date_collection_arr);
editor9.putString("task list", json);
editor9.apply();
}
So any ideas? How could I use "context" in this case?