ClipEXActivity.java
case R.id.button_msave:
nm = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
PendingIntent intent = PendingIntent.getActivity(
ClipEXActivity.this, 0,
new Intent(ClipEXActivity.this, SimpleNotifi.class), 0);
String ticker = pre_cb.getText().toString();
String title = "Memo";
String text = pre_cb.getText().toString();
// Create Notification Object
Notification notification =
new Notification(R.drawable.copy,ticker,System.currentTimeMillis());
notification.setLatestEventInfo(ClipEXActivity.this,title,text,intent);
nm.notify(1000, notification);
Intent it = new Intent();
it = new Intent(this, SimpleNotifi.class);
it.putExtra("it_pre_cb",text);
Toast.makeText(ClipEXActivity.this,"Memo 등록",Toast.LENGTH_SHORT).show();
startActivity(it);
break;
SimpleNotifi.java
public class SimpleNotifi extends Activity {
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final ClipboardManager clipboardManager = (ClipboardManager)
getSystemService(Context.CLIPBOARD_SERVICE);
Intent it = getIntent();
String pre_cb = it.getStringExtra("it_pre_cb");
String txt = pre_cb;
clipboardManager.setText(pre_cb);
Toast.makeText(SimpleNotifi.this,pre_cb+"/클립보드에 복사되었습니다.",Toast.LENGTH_SHORT).show();
NotificationManager nm =
(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
finish();
}
}
button_msave버튼을 클릭하면
상단바 등록을위해 pre_cb 라는 TextView에 담긴 내용을 String text에 담아서
SimpleNotifi.java으로 Intent 해서 넘겨서 상단바를 클릭하면 그 text 내용을 클립보드에 복사하는 코드인데요
처음에 button_msave 누르면
startActivity(it)으로 SimpleNotifi.java 실행되면서 제대로 클립보드에 복사가되는데
상단바 등록되고나서 상단바 클릭 하면 pre_cb값이 복사가 되야되는데 null값으로 저장이 되버리네요..
뭐가 문제일까요