이 앱을 제작 중입니다. 내가하고 싶은 일은 버튼 클릭으로 알림 막대에 내 활동 아이콘을 표시하는 것입니다. 다른 사건이 끝날 때까지 거기에 머물러 있기를 바랍니다. 현재이 코드를 dound하지만 친절하게 나에게이 작업을 수행하는 쉬운 방법을 말해, 오류를 많이 제공 :알림 바에 앱 아이콘 표시
save.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(icon.isChecked()) {
CharSequence text = getText(R.string.local_service_started);
// Set the icon, scrolling text and timestamp
Notification notification = new Notification(R.drawable.ic_launcher, "Track Your Life", System.currentTimeMillis());
// The PendingIntent to launch our activity if the user selects this notification
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
new Intent(), 0);
// Set the info for the views that show in the notification panel.
notification.setLatestEventInfo(this, getText(R.string.local_service_label), text, contentIntent);
// Send the notification.
mNM.notify(NOTIFICATION, notification);
}
}
});
당신이 원하는 것을 인쇄 화면을 추가 달성 –
단순히 내 알림 아이콘에 내 앱의 아이콘을 남기고 싶습니다. 온라인 상태에서 Whatsapp 또는 skype 아이콘을 좋아하세요. –
"많은 오류"가 무엇을 의미하는지 ** 완전하고 정확하게 ** 설명하십시오. 또한'Notification.Builder' 나'NotificationCompat.Builder'를 직접 쓰는 대신'Notification.Builder'를 사용하는 것이 좋습니다. – CommonsWare