I'm trying to create a clickable TextView
in a notification.
I've created a layout with some TextViews
and I use a remoteView
to build the notification layout.
In the notification build method I use setOnClickPendingIntent()
to assign a Pending Intent
to the TextView
.
When I actually try to click the TextView
the whole notification is 'clicked' (as there is no clickable area besides the whole notification as one block).
I've tried removing the pendingIntent
of the notification itself, but yet the whole notification is clicked (just does nothing).
What should be done to make these elements be clickable ?
Are only buttons be clickable in a notification ?
Asked
Active
Viewed 689 times
2

SagiLow
- 5,721
- 9
- 60
- 115
-
Go through this http://stackoverflow.com/questions/12438209/handling-buttons-inside-android-notifications and this http://stackoverflow.com/questions/5479165/event-onclick-for-a-button-in-a-custom-notification – Jitender Dev Jan 19 '14 at 10:12
-
I've tried both `setOnClickPendingIntent` and `setPendingIntentTemplate`, all the other is the same, still nothing happens. – SagiLow Jan 19 '14 at 11:25
1 Answers
2
Mention android:clickable="true" for textviews in layout.
Like:
<TextView android:id="@id/tv1"
android:clickable="true"/>
By programmatically:
textview.setClickable(true);

user543
- 3,623
- 2
- 16
- 14
-
Now the notification is not clicked as a block, but the TextView click doesn't do anything – SagiLow Jan 19 '14 at 11:19