Android Clickable AppWidget Disable Sound on Click - android

I have an AppWidget (part of my app). I want there to be no sound when the user clicks a button in the widget.
How do I do this?

CommonsWare answered it:
This is not a method on RemoteViews, and setSoundEffectsEnabled() is not a RemotableViewMethod, so the literal answer is incorrect. However, android:soundEffectsEnabled="false" in the layout file may work.
setting android:soundEffectsEnabled="false" in the xml layout file does indeed work!

As far as I know, you have to turn off notification sounds (pressing volume down, then selecting settings on it). The click sound is usually created by the OS (Samsung Android will have a click but google Nexus will not). The only other way I can think of is, if the widget is yours, create a custom button that overrides that particular functionality.

Add the following line of code to disable the click sound,
yourbutton.setSoundEffectsEnabled(false);

Related

Android recording voice when a button is clicked

I have a 'Play'button set up in an XML layout file,
<Button
android:id="#+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="play"
android:onClick="playButton"
/>
and I want to make it so that when I click on the button, an action dialog shows in which there are two buttons that say 'Play' and 'Stop'.
When I click on the Play button I want the app to record whatever the user is saying to the microphone and when the 'Stop' button is pressed, save that mp3 into resources.
How can I make this? I'm right now really confused because my
and yes, I've seen the Android documentation & sample codes on Media Recorder and I still don't get it...
try to see this resource on Github android-MediaRecorder
make something similar that you dear, but use camera of the devices. By the way you can start from here and make some adjustment
By the way , you can find more project like this, ad example this AndroidAudioRecorder
that are already did.
Maybe this can be help you
Have a nice work!

Add custom audible feedback to Android button

I want to add custom audible feedback to a button press (various click sounds encoded as *.ogg) I've done this by using the RingtoneManager to create Ringtones for each of the clicks and then .play() them in the onClick() method. This works but seems a little sluggish. This leaves me wondering if there is a better way to attach a custom sound effect to a button press. I've scanned the Button reference page and all I found was playSoundEffect() which seems to handle only system defined sounds.
thanks,
hank
Use a SoundPool- they work it preloads the data into memory (so no file reads which cause sluggishness). Ringtones are definitely not what you want to be using here- those are typically much longer and not time critical (delaying a ringtone by a second or so isn't a problem, whereas delaying a button sound effect by that long is).

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.
You cannot put interactive widgets, like a Button, in a Notification and get user input from them. These are for output display only.
We can made custom notification and put buttons into that and also can perform different functionality on that onClick function, recently I was stuck in the same problem but this link
Handling buttons inside android notifications
save my life.
You can also see my code here
Adding button action in custom notification
and it actually works on my HTC Sensation XE havent tried on other devices yet. So cheer and good luck

Android: Adding a button on a status bar notification

I am trying to create a custom status bar notification in Android that has a button in addition to the text. The button can do a different thing than when you click the notification itself.
Is this possible at all? I'd also be ok putting an image of a button there instead. I know how to put an image, but not sure how to handle OnClick for an image embedded in RemoteViews. Your help is sincerely appreciated.
Thanks a lot in advance.
I don't think you can get a button on the status bar itself but you can certainly do it using a Custom Expanded View (see http://developer.android.com/guide/topics/ui/notifiers/notifications.html)
try use this way,the first is the view ID,
the second is a Pending intent..
RemoteViews.setOnClickPendingIntent(R.id.push_notifi_content, Pdit);
I have try it,but seems it just support in android4.0
I am working on this end as well. It is straightforward from HoneyComb onwards: look at the music app (it has a status bar control when playing). And you can implement yours with your_notification_remote_view_instance.setOnClickPendingIntent(R.id.a_button_in_notification, pending_intent_to_be_handled_by_a_service); while backing it with a service to handle the intent properly of course. While buttons can be embedded in earlier versions, they don't get focus or click when pressing.

How to highlight clicks in app widget?

I have an app widget which runs neatly. However, I am unable to highlight a click on a linked item. I've seen it in the standard app widgets like 'Music' and 'Power Control', for instance. Moreover, I've also been studying the Music app widget's source at album_appwidget.xml. The only thing I could think of is the LinearLayout defined at lines 23-35 which states
android:clickable="true"
Unfortunately, this does not work for me. So does anyone have a hint on how to highlight a click on an app widget? I've tried the LinearLayout, TextView and Button. None of them displayed a border as a highlight.
Thanks in advance,
Steff
you need to create images for those states like focussed state, pressed etc like in a button and define them in your background.
Try looking at the custom buttons where its explained how to accomplish the task thats similar to your needs.
http://www.gersic.com/blog.php?id=56.
if you want to look more and add more states you may ge better idea if you look at the android source code for buttons where they have images for each state of the button and every other widget.

Categories

Resources