Currently ran into an issue trying to update a list fragment with a dialogfragment input (or dummy input) everything compiles but don't see any change to the list. Please let me know what you think. Thanks.
public class NewEventDialogFragment extends DialogFragment {
private List<GlobalClass> mItems;
EditText editText;
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
//editText = (EditText) findViewById(R.id.editText);
builder.setMessage("What Would You Like to Name the Event?")
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
mItems = new ArrayList<GlobalClass>();
mItems.add(new GlobalClass("Whoiszzzzzzzzzzzzzzthis", "Adsdfdsdomg"));
mItems.add(new GlobalClass("Whodsfzzzzzzzzzzzzzsdfsisthis", "Addsdfdfomg"));
mItems.add(new GlobalClass("Whoisthzzzzzzzzzzzzzzsdfdsfis", "Addosdfsdfmg"));
// Create the adapter to convert the array to views
MainTabsPagerAdapter adapter = new MainTabsPagerAdapter(getActivity(), mItems);
// Attach the adapter to a ListView
adapter.addAll(mItems);
adapter.notifyDataSetChanged();
//setListAdapter(new MainTabsPagerAdapter(getActivity(), mItems));
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// User cancelled the dialog
}
});
View view = getActivity().getLayoutInflater().inflate(R.layout.neweventdialog_fragment, null);
builder.setView(view);
return builder.create();
}
}
private List<GlobalClass> mItems; // ListView items list
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// initialize the items list
mItems = new ArrayList<GlobalClass>();
Resources resources = getResources();
mItems.add(new GlobalClass("Whoisthis", "Adsdfdsdomg"));
mItems.add(new GlobalClass("Whodsfsdfsisthis", "Addsdfdfomg"));
mItems.add(new GlobalClass("Whoisthsdfdsfis", "Addosdfsdfmg"));
// initialize and set the list adapter
setListAdapter(new MainTabsPagerAdapter(getActivity(), mItems));
}