解决android锁屏或解锁后activity重启的问题

If your target build version is Honeycomb 3.2 (API Level 13) or higher you must put the screenSize flag too, as in:

<activity
    android:configChanges="orientation|screenSize|keyboardHidden"
    android:name="YOUR ACTIVITY NAME">
</activity>

because even with the "orientation" flag you app will be killed and recreated again with every orientation change when your app is the active one, either being visible on screen or hidden by the lock screen. This is because the usable screen size, mainly in tablets, actually changes due to the change in placement of the system action bar.

时间: 2024-08-12 04:00:04

解决android锁屏或解锁后activity重启的问题的相关文章

android锁屏软件制作

转载请标明出处http://blog.csdn.net/mingyue_1128 一.首先要创建一个Service保证Service一直开启,同时不被一键清理掉. 二.屏蔽掉系统的锁屏 三.创建锁屏的Activity,在Activity中屏蔽掉back,menu,home键 四.保证自己的进程不在最近任务中出现 一.创建一个Service名字为LockService public class LockService extends Service{ private KeyguardManager

锁屏上显示Activity

在Android中,有些比较强的提醒,需要用户紧急处理的内容.需要唤醒屏幕,甚至在锁定屏幕的情况下,也要显示出来.例如,来电界面和闹钟提醒界面.这是怎样实现的呢? 其实,实现起来非常简单.只要给Activity的Window添加如下属性即可: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().addFlags(WindowMa

android横竖屏切换时Activity的生命周期

1.新建一个Activity,并把各个生命周期打印出来 2.运行Activity,得到如下信息 onCreate--> onStart--> onResume--> 3.按crtl+f12切换成横屏时 onSaveInstanceState--> onPause--> onStop--> onDestroy--> onCreate--> onStart--> onRestoreInstanceState--> onResume--> 4.再

jQuery仿Android锁屏图案应用插件

<!doctype html> <html> <head> <meta charset="utf-8"> <title>jQuery仿Android锁屏图案应用插件DEMO演示</title> <link href="css/patternLock.css" rel="stylesheet" type="text/css" /> <scr

Android锁屏状态下弹出activity,如新版qq的锁屏消息提示

在接收消息广播的onReceive里,跳转到你要显示的界面.如: Intent intent = new Intent(arg0,MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);         arg0.startActivity(intent); 在该activity的onCreate()方法里: super.onCreate(savedInstanceState); getWindow().addFla

Android锁屏状态下弹出activity

在接收消息广播的onReceive里,跳转到你要显示的界面.如: Intent intent = new Intent(arg0,MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); arg0.startActivity(intent); 在该activity的onCreate()方法里: super.onCreate(savedInstanceState); getWindow().addFlags(Windo

Android 锁屏生命周期问题

今天在做视频播放时碰到了一个问题:当用户按下电源键锁屏后(屏幕黑了)视频播放停止了.但是当按下解锁键后(屏幕亮,但是未解锁)的时候视频开始自动播放了. 我的Activity在manifest.xml 配置如下 android:configChanges="locale|orientation|keyboardHidden" android:screenOrientation="landscape" 解决办法: 需要在android:configChanges=&qu

Android锁屏软件

需求描述:锁屏软件就是点击应用然后直接锁屏,不会弹出任何界面 设计思路:应用启动以后通过getSystemService获取系统的服务,调用安卓系统的DevicePolicyManager和ComponentName来对系统进行操作,先判断用户是否有相应的权限,如果有,直接锁屏,如果没有就先获取系统权限,再锁屏 废话不说,直接上代码 Main.java(主页面) 1 package com.example.wangshibang.screenlock; 2 3 import android.ap

Android 锁屏监听

package com.example.lockscreenlistenerdemo; public interface LockScreenListener { String Tag="LockScreenListener"; public void onScreenOn(); public void onScreenOff(); public void onUserPresent(); } 做一个监听接口. 监听广播,监听锁屏 解锁  点亮屏幕的Action package com