Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
AndroidPolice BugWatch 4.3 Demo - ClipboardManager
package com.androidpolice.bugwatch43demo.ClipboardManager;
import android.content.ClipboardManager;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
public class MainActivity extends Activity {
private Button btnEnable;
protected void onCreate(Bundle savedInstanceState) {
private void initControls() {
btnEnable = (Button) findViewById(;
private View.OnClickListener onClick_Enabled = new View.OnClickListener() {
public void onClick(View v) {
ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
manager.addPrimaryClipChangedListener(new ClipboardManager.OnPrimaryClipChangedListener() {
public void onPrimaryClipChanged() {
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(, menu);
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment