package com.example.android.groupschedulecoordinator;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import java.util.ArrayList;

public class ActivityCreateGroup extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_create_group);
    }

    public void createGroup(View v) {
        EditText text =  (EditText) findViewById(R.id.tbGroupName);
        String groupName = text.getText().toString();
        if(groupName.isEmpty())
        {
            android.content.Context context = getApplicationContext();
            CharSequence warning = "Please enter a valid group name.";
            int duration = Toast.LENGTH_SHORT;

            Toast toast = Toast.makeText(context, warning, duration);
            toast.show();
        }
        else
        {
            Intent intent = new Intent(ActivityCreateGroup.this, MainActivity.class);

            Bundle extras = getIntent().getExtras();
            ArrayList<String> group_list = extras.getStringArrayList("groupList");
            group_list.add(groupName);

            //intent.putExtra("groupName", groupName);
            intent.putStringArrayListExtra("groupList", group_list);

            startActivity(intent);
        }





    }
}

@@ -1284,16 +1284,128 @@
 pList%22);
+%0A%0A            if(group_list == null)%0A            %7B%0A                group_list = new ArrayList%3C%3E();%0A            %7D
 %0A       

Fix crash when adding new group names