package com.example.patrice.preferences;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.Toast;


public class activity_receive_data extends Activity
{

    LinearLayout containerTwo;
    LinearLayout li;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        // set the layout of the Activity
        setContentView(R.layout.activity_receive_data_view);

        //LinearLayout li=(LinearLayout)findViewById(R.id.containerTwo);
        //li.setBackgroundColor(Color.GREEN);

        // get the intent that we have passed from ActivityOne
        Intent intent = getIntent();

        // get the extra value
        String color = intent.getStringExtra("color");

        Toast.makeText(this, color, Toast.LENGTH_LONG).show();



        changeBackground(color);
    }

    public void changeBackground(String color)
    {
        LinearLayout li=(LinearLayout)findViewById(R.id.containerTwo);

        if (color.equals("red"))
        {
            li.setBackgroundColor(Color.RED);
            //containerTwo.setBackgroundColor(Color.RED);
        }
        /*
        else if (color.equals("green")) {
            containerTwo.setBackgroundColor(Color.GREEN);
        } else if (color.equals("blue")) {
            containerTwo.setBackgroundColor(Color.BLUE);
        }*/

    }

}
