2011-02-27 2 views
0

이 링크에서 상태 표시 줄에보기를 추가 할 수 있습니다. http://developer.android.com/guide/topics/ui/notifiers/notifications.html. 에 대한 이벤트를 정의하는 방법. 버튼에 onclick 이벤트를 설정하는 방법보다 두 개의 버튼을 추가한다고 가정합니다.사용자 정의 확장보기에 대한 이벤트가 상태 표시 줄 알림에 추가 되었습니까?

이것은 원격보기 용 코드입니다.

RemoteViews contentView=new RemoteViews(getPackageName(),R.layout.demo); 
     notification.contentView = contentView; 

     notification.flags |= Notification.FLAG_NO_CLEAR; 
     notification.flags |= Notification.FLAG_ONGOING_EVENT; 
     Intent intent = new Intent(getApplicationContext(), Main.class); 
     PendingIntent contentIntent = PendingIntent.getActivity(this, 0, 
       intent, Intent.FLAG_ACTIVITY_NEW_TASK); 

     notification.contentIntent=contentIntent; 
     nm.notify(NOTIFY_ID, notification); 

여기에서 R.layout.demo 버튼이 있습니다. 여기 이벤트를 정의 할 수 있습니다. 당신의 RemoteViews

답변

1

thankx, 그 버튼을 클릭 할 때 호출됩니다 PendingIntent을 공급, setOnClickPendingIntent()를 호출합니다.

관련 문제