When I call a Dialog from another Class which is not an Activity, I want to Invalidate the Listview from its calling Activity and NotifyDatasetChange the Adapter after dismissing the Dialog.
public class SingleAudioBook extends Activity {
private ListView lv;
public void onCreate(Bundle savedInstanceState) {
lv = (ListView) findViewById(R.id.lvSingleSong);
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
MyDialog.callLoginDialog(SingleAudioBook.this);
}}}
and my dialog is:
public class MyDialog {
private static Dialog myDialog;
public static void callLoginDialog(final Context c){
...
}
You can use static reference of listView and Adapter. Replace your declaration with following-
Your_Activity -
Use in another class-