I want to **open my application and display copied text** whenever i have copied the text from anywhere in android. how can i do this?

```
  public class MainActivity extends Activity
{

    Button paste;
    TextView display;
    private ClipData clipdata;
    private android.content.ClipboardManager mgr;

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

        paste = (Button) findViewById(R.id.paste);
        display = (TextView) findViewById(R.id.textView1);

        mgr = (android.content.ClipboardManager) getSystemService(CLIPBOARD_SERVICE);

        paste.setOnClickListener(new OnClickListener()
        {
            public void onClick(View arg0)
            {

                try
                {
                    clipdata = mgr.getPrimaryClip();
                    ClipData.Item item = clipdata.getItemAt(0);

                    String text = item.getText().toString();

                    display.setText(display.getText() + "\n" + text);

                    Toast.makeText(getApplicationContext(), "Text Pasted",
                            Toast.LENGTH_SHORT).show();
                } catch (Exception e)
                {
                    Toast.makeText(getApplicationContext(),
                            "Error : " + e.getMessage(), Toast.LENGTH_SHORT)
                            .show();
                }
            }
        });
    }

}

```

* i have tried to open the app using intent
* I'm using android studio
* what are the changes i have need to do