package jp.naist.inet_lab.android.ipv6multicastchat;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity {

    private Button buttonJoin;

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

        // A button for join the multicast group
        this.buttonJoin = (Button) this.findViewById(R.id.buttonJoin);
        this.buttonJoin.setOnClickListener(new OnClickListener() {

            @Override
            /*
             * Start the ChatActivity
             */
            public void onClick(View v) {
                // FIXME: Validate the input(check the name and the address are
                // valid)

                // Start the ChatAcrivity

            }

        });
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }

}

@@ -102,16 +102,47 @@
 tivity;%0A
+import android.content.Intent;%0A
 import a
@@ -256,16 +256,48 @@
 .Button;
+%0Aimport android.widget.EditText;
 %0A%0Apublic
@@ -366,16 +366,86 @@
 tonJoin;
+%0A    private EditText editName;%0A    private EditText editGroupAddress;
 %0A%0A    @O
@@ -602,16 +602,289 @@
 main);%0A%0A
+        // A form for input the handle-name%0A        this.editName = (EditText) this.findViewById(R.id.editName);%0A%0A        // A form for input the multicast group address%0A        this.editGroupAddress = (EditText) this%0A                .findViewById(R.id.editGroupAddress);%0A%0A
         
@@ -1306,51 +1306,508 @@
 id)%0A
-%0A                // Start the ChatAcrivity%0A
+                String name = editName.getText().toString();%0A                String groupAddress = editGroupAddress.getText().toString();%0A%0A                // Start the ChatAcrivity%0A                Intent intentToChatActivity = new Intent(%0A                        getApplicationContext(), ChatActivity.class);%0A                intentToChatActivity.putExtra(%22name%22, name);%0A                intentToChatActivity.putExtra(%22group_address%22, groupAddress);%0A                startActivity(intentToChatActivity);
 %0A   

Add StartActivity on MainActivity to start CharActivity