package com.example.myapplication;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

import java.util.concurrent.ArrayBlockingQueue;

public class MainActivity extends AppCompatActivity {
    ArrayBlockingQueue arrayBlockingQueue;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        arrayBlockingQueue= new ArrayBlockingQueue<>(50);
        final TextView actionEvent = findViewById(R.id.actionEvent);
        arrayBlockingQueue.add("sai");
        arrayBlockingQueue.add("ram");
        arrayBlockingQueue.add("krishna");
        arrayBlockingQueue.add("prasad");
        actionEvent.setText("" + arrayBlockingQueue);
       actionEvent.setOnClickListener(new View.OnClickListener() {
           @SuppressLint("SetTextI18n")
           @Override
           public void onClick(View v) {
               actionEvent.setText("" + arrayBlockingQueue.size());
           }
       });


    }

}


