public
Created

AndroidPolice BugWatch 4.3 Demo - ClipboardManager

  • Download Gist
MainActivity.java
Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
package com.androidpolice.bugwatch43demo.ClipboardManager;
 
import android.content.ClipboardManager;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
 
public class MainActivity extends Activity {
 
private Button btnEnable;
 
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
 
initControls();
}
 
private void initControls() {
btnEnable = (Button) findViewById(R.id.button_enable);
btnEnable.setOnClickListener(onClick_Enabled);
}
 
private View.OnClickListener onClick_Enabled = new View.OnClickListener() {
@Override
public void onClick(View v) {
ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
manager.addPrimaryClipChangedListener(new ClipboardManager.OnPrimaryClipChangedListener() {
@Override
public void onPrimaryClipChanged() {
 
}
});
}
};
 
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.