package com.papier.jurani;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

/**
 * Created by Angellica on 3/20/2016.
 */
public class ChosenPlayerActivity extends AppCompatActivity {

    private String chosenName;
    private TextView theone;
    private Bundle str;
    private Button repeat;
    private Button truth;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_theone);
        Toolbar toolbar = (Toolbar) findViewById(R.id.random_player_toolbar);
        setSupportActionBar(toolbar);

        str = getIntent().getExtras();
        chosenName = str.getString("chosen");

        theone = (TextView) findViewById(R.id.chosen_name);
        theone.setText(chosenName);

        repeat = (Button) findViewById(R.id.repeat_button);
        repeat.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        truth = (Button) findViewById(R.id.truth_button);
        truth.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent goToTruth = new Intent (getApplicationContext(), RandomTruthActivity.class);
                startActivity(goToTruth);
            }
        });
    }

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

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_help) {
            Intent goToHelp = new Intent (getApplicationContext(), HelpActivity.class);
            startActivity(goToHelp);
            return true;
        } else if (id == R.id.action_developer) {
            Intent goToDev = new Intent (getApplicationContext(), PengembangActivity.class);
            startActivity(goToDev);
            return true;
        } else if (id == R.id.action_reset) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}

@@ -442,26 +442,25 @@
  String 
-chosenName
+%5B%5D player
 ;%0A    pr
@@ -469,47 +469,60 @@
 ate 
-TextView theone;%0A    private Bundle str
+String chosenPlayer;%0A    private TextView chosenText
 ;%0A  
@@ -571,16 +571,41 @@
 n truth;
+%0A    private Button dare;
 %0A%0A    @O
@@ -754,22 +754,29 @@
 ctivity_
-theone
+chosen_player
 );%0A     
@@ -895,18 +895,21 @@
         
-st
+playe
 r = getI
@@ -923,18 +923,37 @@
 .get
-Extras(
+StringArrayExtra(%22player%22
 );%0A
+%0A
     
@@ -966,18 +966,40 @@
 osen
-Name = str
+Player = getIntent().getExtras()
 .get
@@ -1025,22 +1025,26 @@
         
-theone
+chosenText
  = (Text
@@ -1093,14 +1093,18 @@
     
-theone
+chosenText
 .set
@@ -1118,12 +1118,14 @@
 osen
-Name
+Player
 );%0A%0A
@@ -1668,31 +1668,656 @@
     
-startActivity(goToTruth
+goToTruth.putExtra(%22player%22, player);%0A                goToTruth.putExtra(%22chosen%22, chosenPlayer);%0A                startActivity(goToTruth);%0A                finish();%0A            %7D%0A        %7D);%0A%0A        dare = (Button) findViewById(R.id.dare_button);%0A        dare.setOnClickListener(new View.OnClickListener() %7B%0A            @Override%0A            public void onClick(View v) %7B%0A                Intent goToDare = new Intent (getApplicationContext(), RandomDareActivity.class);%0A                goToDare.putExtra(%22player%22, player);%0A                goToDare.putExtra(%22chosen%22, chosenPlayer);%0A                startActivity(goToDare);%0A                finish(
 );%0A 

Edit some code.