Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

android - How to add a button into notification?

I do it like this:

RemoteViews views = new RemoteViews(..);
views.setOnClickPendingIntent(R.id.button1,pd);
noti.contentviews = views;

and then notify the notification. I can see the button in the notification, but the button can't be clicked. When i click the button,the whole notification clicked! How can i resolve this question? I found everywhere for this,but nothing useful found. someone said, some phones don't support the notification button, but samsung galaxy s, the musicplayer's notification has button click event.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You cannot put interactive widgets, like a Button, in a Notification and get user input from them. These are for output display only.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...