android-homebutton

How to disable home button in Android like lock screen apps do?

血红的双手。 提交于 2019-12-03 19:07:19
问题 I know this question is asked many times but I found that none of the solution is working. I tried the code given below... protected void onPause() { super.onPause(); Intent intent = new Intent(this,LockActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT |Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } What it does is that it bring the current activity again to front when android home screen is launched but it takes almost 3-4 seconds to bring activity againt to

Clicking app icon doesn't trigger onOptionsItemSelected()

此生再无相见时 提交于 2019-12-02 22:06:54
I'm currently working on an Android app. I would like to use the app icon in the action bar to navigate to the "home" activity. I read on this page that all that needs to be done is to add an onOptionsItemSelected and look for the id android.R.id.home . This is the code that I have implemented in my activity where I want to press the app icon to return to HomeActivity . @Override public boolean onOptionsItemSelected(MenuItem item) { switch(item.getItemId()) { case android.R.id.home: Intent intent = new Intent(this, HomeActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

What is the keycode for multitasking/appswitch for samsung galaxy s3?

女生的网名这么多〃 提交于 2019-12-02 19:52:37
问题 Our app is crashing (it says "application has stopped) after we longpress the home button on samsung galaxy s3 (the longpress button is used to popup the multitasking screen/app switch dialog) we do not have this problem on our another testing device htc evo 3d so what is the keycode for this "action" ? and how can we disable this function ? This code sadly does not work: public boolean onKeyDown(int keyCode, KeyEvent event) { if(keyCode == KeyEvent.KEYCODE_APP_SWITCH) { System.exit(0);

What is the keycode for multitasking/appswitch for samsung galaxy s3?

倾然丶 夕夏残阳落幕 提交于 2019-12-02 08:35:25
Our app is crashing (it says "application has stopped) after we longpress the home button on samsung galaxy s3 (the longpress button is used to popup the multitasking screen/app switch dialog) we do not have this problem on our another testing device htc evo 3d so what is the keycode for this "action" ? and how can we disable this function ? This code sadly does not work: public boolean onKeyDown(int keyCode, KeyEvent event) { if(keyCode == KeyEvent.KEYCODE_APP_SWITCH) { System.exit(0); return false; } return super.onKeyDown(keyCode, event); } 来源: https://stackoverflow.com/questions/26554207

Intercepting home button on Android

核能气质少年 提交于 2019-12-02 02:53:36
I've researched this a lot and it seems that after ICS normal applications can no longer intercept the Home Button. However, I see apps like Go Locker that are able to trap the Home Button. If Go Locker isn't intercepting the home button, what are they doing to prevent the user from going to the home screen? Illegal Argument You cannot intercept the home button. You cannot disable it. The way how the go locker does it is by drawing its layout over other apps. It requires extra permission. See this link for more details here. 来源: https://stackoverflow.com/questions/23772386/intercepting-home

Enable home button ActionbarSherlock, Sherlockfragment

岁酱吖の 提交于 2019-12-01 18:03:05
I want to enable the home button in my fragment. This question is asked earlier but for an activity. I tried ... getSupportActionBar().setDisplayHomeAsUpEnabled(true); ... but this doesn't work. Here is my code: import com.actionbarsherlock.R; import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.app.ActionBar.Tab; import com.actionbarsherlock.app.SherlockFragment; import com.actionbarsherlock.view.MenuItem; import android.support.v4.app.Fragment; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import

Android, How to receive home button click through broadcast receiver?

ぐ巨炮叔叔 提交于 2019-12-01 13:39:40
In my application I need to send log-out request to server when ever user goes out of application via clicking on log-out button or closing application by pressing home button key. There is no problem with button and result is as I expect. The problem is how to get home button. Based on my research it is not possible to use onKeyDown(int keyCode, KeyEvent event) as we can use for getting back button. The solution that I'm thinking about is registering a receiver and sending a broadcast whenever Home button clicked. So through receiver I can launch a service to send log-out request to server.

Android, How to receive home button click through broadcast receiver?

▼魔方 西西 提交于 2019-12-01 11:22:43
问题 In my application I need to send log-out request to server when ever user goes out of application via clicking on log-out button or closing application by pressing home button key. There is no problem with button and result is as I expect. The problem is how to get home button. Based on my research it is not possible to use onKeyDown(int keyCode, KeyEvent event) as we can use for getting back button. The solution that I'm thinking about is registering a receiver and sending a broadcast

How to handle that the application is minimized by HOME button

99封情书 提交于 2019-12-01 09:15:30
问题 An issue has appeared a few days ago. I have an application that listen for GPS location. The listener is a background service that works all the time, this service saves data in application level and each activity reads this data. So, when i press back button i am able to catch this event and i can stop the service, but when i press HOME button the service is still working although the application is in background mode and this consumes battery, because the GPS always works. How can i handle

Android: How to control the home button

三世轮回 提交于 2019-11-30 22:04:43
We're trying to provide an application to the mentally and physically handicapped daughter of my neighbor that let's her use an Android tablet as a Talker, i.e., she presses a few big buttons and the devices generates speech. The application is basically a WebView and an additional object in Javascript used to perform and control the speech generation, plus some logic to handle the orientation changes. Html files are generated offline for her specific layout of the talking items. We've also added some music playing and picture viewing facilities to make the device more appealing to her.