Android :: Way To Catch Event When Sleep Button Pressed?
Aug 8, 2010I would like to write an application which shutdown (finish()) itself when the sleep button is pressed. Any hint?
View 3 RepliesI would like to write an application which shutdown (finish()) itself when the sleep button is pressed. Any hint?
View 3 RepliesWith the physical keyboard you can catch key presses with a KeyListener, something like. code...
Does anyone know how to do this (or similar) with the virtual keyboard?
Does anybody know how to catch the map zoom in/out event for Android 1.5?Before Android 1.5, I can use ZoomControls which has a setOnZoomInClickListener(). In order to get zoom controls, I can write like this:ZoomControls mZoom = (ZoomControls) mMapView. getZoom Controls(); But, since 1.5, the mMapView.getZoomControls() is deprecated. Instead of this, the documentation suggests using mMapView.setBuiltInZoomControls.Since 1.6, I can use ZoomButtonsController, which has a set OnZoomListener(). In order to get zoom button controls, I can write like this:ZoomButtonsController mZoom = (ZoomButtonsController) mMapView.getZoomButtonsController().setOnZoomListener(this);So, how can I get map zoom in/out event without using mMapView.getZoomControls() for Android 1.5 ?
View 3 Replies View RelatedI'm clearly a newb, and I was wondering if anyone knows how I can detect a "ring" event on my cellphone through the android sdk? Generally I want to do something with the phone when it begins ringing! Any thoughts? If you want to simply point me to a page in the api documents that would be a good answer for me, I just don't know how to start my research!
View 1 Replies View RelatedHow to catch event from the virtual keyboard?In fact, I want to know if the screen is touch for instance.
View 4 Replies View RelatedI am trying to find a way to listen to a built-in Camera application Capture event.I want my application to be triggered each time a picture is taken. Is it possible?
View 1 Replies View RelatedActually I'm trying to implement an ontouchlistener into my android (1.5) application. therefore i implemented the "ontouchlistener" into the class, and then i put my code into the: So isn't there a way to catch the touch event before it gets to each of those views?
View 1 Replies View RelatedWhen the user presses editText, the soft keyboard pops up. I want to hide a view or 2 while it is on. How to do that?
View 1 Replies View RelatedIs it possible to catch the event that Soft Keyboard was shown or hidden for EditText?
View 2 Replies View RelatedI was investigating the issue of setting up a delayed activity/event, that will occur and trigger even if the phone is in sleep mode (wake up, do what you need to do, go back to sleep). I was thinking of the following methods: 1. sendMessageDelayed 2. Timer 3. AlarmManager.The basic requirement is to be able to set a triger in the future, and be sure that this trigger wakes up the system if it is sleeping,perform the task, and go back to sleep.A partial wakup is required (no screen flickering). Currently i'm using the sendMessageDelayed, and i keep a wake lock held for the timeout period (bad practice).
View 8 Replies View RelatedI want to show some notification when android phone is connected to system. I implemented BroadcastReceiver for listening to event android.intent.action.ACTION_UMS_CONNECTED in my application But it is not working. Is it possible to capture this event.
View 3 Replies View RelatedDoes anyone know how to tell when the headset button is being pressed? I'd like to support the usb headsets and possibly bluetooth headsets. My app is a media player and ideally, I could register it somewhere so that if no app that uses the headset button has focus it button press would act as a play/pause command in my app. If the phone is ringing or a call is in progress, I'd like to be sensitive to that and let the button do what it normally does: pickup and hang up calls. we've been trying to chase the button down using this: Intent Filter headset Filter = new Intent Filter (Intent.ACTION_HEADSET_PLUG); headset Filter.addAction ("android.intent.action.HEADSET_STATE_CHANGED"); headsetFilter.addAction("android.bluetooth.intent.HEADSET_STATE"); headset Filter.addAction ("android.bluetooth.intent.HEADSET_STATE_CHANGED"); headset Filter.addAction ("android.bluetooth.intent.action.MODE_CHANGED"); headsetFilter.addAction("android.intent.action.MODE_CHANGED");
View 6 Replies View RelatedIs there a way I could get the color that is used when a button is pressed? I know that the button uses a default selector xml that consists of the pressed image. But, I am having some custom buttons for which I want it to be close to the default image used for pressed state.
View 5 Replies View RelatedIs there an easy way in android to get the pressure that the user extended during an onClick event?
View 1 Replies View Relatedi have an app widget that has a couple of buttons on it, and in my onUpdate() call, I am hooking up the buttons to do something when you press them
RemoteViews remoteViews = new RemoteViews(context.getPackageName (), R.layout.appwidget); remoteViews.setOnClickPendingIntent(R.id.Button1, button1PendingIntent); remoteViews.setOnClickPendingIntent(R.id.Button2, button2PendingIntent);
The problem is that when I click on button2, it sends the button1 pending intent. i think that's because it's reusing the pending intent. http://groups.google.com/group/android-developers/browse_thread/threa. "If the creating application later re-retrieves the same kind of PendingIntent (same operation, same Intent action, data, categories, and components, and same flags), it will receive a PendingIntent representing the same token if that is still valid, and can thus call cancel() to remove it." So then the question is, how do I communicate which button was pressed?
I am trying to catch when the user has pressed the Home button. I thought I could use
protected void onResume()
{
registerReceiver(homeReceiver, new IntentFilter(Intent.CATEGORY_HOME));
}
...
private BroadcastReceiver homeReceiver = new BroadcastReceiver()
{
public void onReceive(Context context, Intent intent)
{
// logic here
}
};
but that doesn't seem to work. I understand that onPause will be called, but my particular app has some logic that I need to handle separately. Short story is based on some info coming in, the app will display new Activities to the user. To prevent Back button issues, as each Activity hits it's onStop it calls finish on itself. However if the user presses the Home button I do not want the Activity to call finish so that when the user presses the app icon on the home screen or via the Recently run apps list, the last Activity is brought back
As the title says, i have a Spinner with just a couple of options and a button. I didnt declared any Listener for the spinner, instead of that, what i want is use the button and perform different actions depending on the spinner selected option.
So, i declared a handler in the button option "android:onClick", but once there, i dont know how to access the option selected in the Spinner.
Is there a way to apply a style to a button when the button is pressed?
View 4 Replies View RelatedI need to know, how to recognize, which button is pressed. Like if i have two buttons ,say button 1 and button2,and both of them performing the same method, say method(),how to determine which button pressed?
View 3 Replies View RelatedI like being able to wake the phone to view the lock screen using the home button at the bottom of the phone, but is there any way to make it so that a second click of that button, or a click of one of the others down there, will make it sleep again? Having to press the power button up top is just an inconvenience.
View 5 Replies View RelatedI am implementing something like the user interface from Microsoft Zune HD player. So, I would like to change the text color of my button when the button is being pressed as well as when it has been clicked.
View 2 Replies View RelatedI want to draw a straight vertical line on my Android activity, when a button is pressed. Please explain how I can draw the line with a position & length I want.I have a linear layout with vertical orientation. A set of buttons constitute this linear layout. When I press one button, I want a line to appear to the right of these buttons, like dividing the screen halfway - a straight line of width=2dip and height=200dip.
View 1 Replies View RelatedI have a BroadcastReceiver that receives SCREEN_ON. If the screen came on because the user pressed a button, I want to do something. However, if the screen was turned on by an app (e.g., alarm clock going off or SMS popup), then I don't want to do anything. Anyone know how I can differentiate between the two cases?
View 2 Replies View RelatedHow can I make my button's size to increase slightly when it is pressed and decrease again when it is released? This is for highlighting the pressed button, by using size in addition to a different color.
View 2 Replies View RelatedI am trying to create a button that has a custom background in the default state, but that still uses the colors for the pressed/selected states that are particular to whatever device it is running on.
View 2 Replies View RelatedI built and app to do a calculation when the button is pressed. However, it force closes when the button is pressed! I have tried adjusting and troubleshooting, but it is eluding me.
View 8 Replies View RelatedI'm using Eclipse to write the android application.
I've added some standard buttons from the Form Widgets tab and successfully got them opening new windows which display additional buttons.
I would like the button that was pressed, to change appearance and continue to look pressed in after it is selected.
In an activity, how do detect the fact that the user pressed the home button?
View 6 Replies View RelatedI have an activity that contains several user editable items (an EditText field, RatingBar, etc). I'd like to prompt the user if the back/home button is pressed and changes have been made that have not yet been saved. After reading through the android documentation, it seems like this piece of code should go in the onPause method. I've tried putting an AlertDialog in the onPause however the dialog gets shown and then immediately tears down because nothing is there to block the pause from completing.
View 1 Replies View RelatedI am having an issue related to home key . when i press home key all current activity gets hidden. but when i press the executable it again starts from the fisrt screen . I have overidden all methods nsaveInstaceState opPause onStop onResume
but there are still issues what is the right way to handle those conditions. When i am pressing home button i am storing the widgets state in database and when i again click the exectable i am checking the database state and starting the new Intent as saved when user presses the home button .Is it the right way to do that as i am facing the problem when user does the same and again presses the back button , there is already on intent available in stack of activity .