- 浏览: 551181 次
- 来自: -
博客专栏
-
libgdx 游戏开发
浏览量:11977
文章分类
- 全部博客 (171)
- OS (1)
- JavaScript (13)
- Struts (2)
- Regular Expression (1)
- Java (14)
- HTML (4)
- XML (1)
- Non-Relational Database (2)
- Miscellaneous (7)
- Lotus Notes (8)
- Algorithm (3)
- Web Analytics (6)
- Web (8)
- Perl (3)
- PHP (3)
- C & C++ (1)
- Shell (7)
- Google (1)
- Android (31)
- iPhone (1)
- SQL (1)
- HTML5 (3)
- jQuery (6)
- CSS (6)
- PostgreSQL (1)
- Design Patterns (1)
- Excel (1)
- Magento (4)
- jMeter (3)
- SEO (1)
- libgdx (5)
- Software (4)
- App (1)
- Game (1)
- Gradle (1)
- Linux (16)
- Ubuntu (4)
- Docker (2)
- Spring (2)
- Other (3)
- Directory Server (1)
- CentOS (1)
- Python (1)
- VCS (3)
- Database (1)
- Open Source (1)
最新评论
-
ls0609:
赞一个,支持下博主。
[原创] Android ListView 在右上角添加三角形图标和文字 -
love297:
不让别人商用,自己先商用起来了。
手机游戏开发展示 -
a851206:
你的有些类是哪里来的?我想研究一下你的程序,可是有些类没有代码 ...
[原创] Google Custom Search & Yahoo Boss Search | Web Search API 使用 -
ypppk:
BitmapFactory.Options options = ...
[原创] 连载 1 - 深入讨论 Android 关于高效显示图片的问题 - 如何高效的加载大位图 -
笑遍世界:
我也遇到了,弄清了其中原因,可参考我的博客:http://sm ...
[原创] 使用 jMeter 登录 Wordpress
原文地址:https://stackoverflow.com/a/30030372
在 AndroidManifest.xml 文件中追加如下代码:
在 MainActivity.java 中追加如下代码,启动 Service:
LockService.java
ScreenReceiver.java
在 AndroidManifest.xml 文件中追加如下代码:
<service android:name="com.example.userpresent.LockService"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> </service>
在 MainActivity.java 中追加如下代码,启动 Service:
startService(new Intent(this, LockService.class));
LockService.java
package com.example.userpresent; import android.app.Service; import android.content.BroadcastReceiver; import android.content.Intent; import android.content.IntentFilter; import android.os.Binder; import android.os.IBinder; import android.support.annotation.Nullable; // https://stackoverflow.com/a/30030372 public class LockService extends Service { @Nullable @Override public IBinder onBind(Intent intent) { return null; } @Override public int onStartCommand(Intent intent, int flags, int startId) { final IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON); filter.addAction(Intent.ACTION_SCREEN_OFF); filter.addAction(Intent.ACTION_USER_PRESENT); final BroadcastReceiver mReceiver = new ScreenReceiver(); registerReceiver(mReceiver, filter); return super.onStartCommand(intent, flags, startId); } public class LocalBinder extends Binder { LockService getService() { return LockService.this; } } }
ScreenReceiver.java
package com.example.userpresent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.util.Log; public class ScreenReceiver extends BroadcastReceiver { public static boolean wasScreenOn = true; @Override public void onReceive(final Context context, final Intent intent) { Log.e("LOB","onReceive"); if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) { // do whatever you need to do here wasScreenOn = false; Log.e("LOB","wasScreenOn"+wasScreenOn); } else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) { // and do whatever you need to do here wasScreenOn = true; }else if(intent.getAction().equals(Intent.ACTION_USER_PRESENT)){ Log.e("LOB","userpresent"); Log.e("LOB","wasScreenOn"+wasScreenOn); String url = "http://www.stackoverflow.com"; Intent i = new Intent(Intent.ACTION_VIEW); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.setData(Uri.parse(url)); context.startActivity(i); } } }
发表评论
-
[转] DialogFragment Fragment already added
2017-10-25 11:16 2619原文地址:http://blog.csdn.net/u0129 ... -
Android Studio .gitignore
2017-10-16 15:44 842参考文献: https://github.com/github ... -
[转] How to detect incoming calls in an Android
2017-10-13 14:14 1172原文地址:https://stackoverflow.com/ ... -
[原创] Android Activity onNewIntent() 详解
2017-08-16 13:46 4723阅读难度:中 阅读前提: 1. 需要了解 Android 的生 ... -
[转] Android Webview: “Uncaught TypeError: Cannot read property 'getItem' of null
2017-08-14 15:09 2250原文地址:https://stackoverflow.com/ ... -
[原创] 使用 Vitamio 播放视频作为 Splash 时出现失真情况的解决方案
2017-08-02 09:10 1187目前在做关于视频及流媒体播放项目时,有这样一个需求,应用启动时 ... -
[转] Android: Expand/collapse animation
2017-07-31 14:57 1540原文地址:https://stackoverflow.com/ ... -
[原创] Android ListView 在右上角添加三角形图标和文字
2017-07-26 17:24 2686最终显示效果如下图,在右上角添加三角形图标并在图标内显示文字: ... -
[转] Detect home button press in android
2017-07-20 17:49 1150原文地址:https://stackoverflow.com/ ... -
[原创] 开启 Android TextView Marquee
2017-07-18 15:47 1785亲测可能。直接上代码。 测试机器:XiaoMi 2S Andr ... -
[原创] 小米手机无法真机调试
2017-07-06 09:10 6454系统环境: 小米 2S MIUI 版本:8.0.1.0(LXA ... -
了解数据绑定 - Data Binding Library
2017-06-22 15:31 901原文地址: -
How to play gif with Fresco
2017-06-22 14:00 634原文地址:https://stackoverflow.com/ ... -
设置 Toolbar(ActionBar) 上的按钮颜色
2017-06-22 08:11 2040原文地址: https://stackoverflow.com ... -
Display back button on action bar and back event
2017-06-22 08:00 718原文地址: https://stackoverflow.com ... -
Gradle 修改 Maven 仓库地址
2017-06-02 15:51 1632修改 Gradle Maven 仓库地址为阿里云镜像 修改根 ... -
[转] How to clear cookies and cache of webview on Android when not in webview?
2017-04-26 09:28 2171原文地址:http://stackoverflow.com/a ... -
[转] Android 在程序中如何动态的修改程序图标
2017-03-02 17:05 885http://stackoverflow.com/a/4150 ... -
[转] Android Libraries
2017-01-16 10:28 543原文地址: https://dzone.com/article ... -
[原创] Android 长按识别图中二维码 - Zxing
2017-01-10 09:27 6327前提: 本文使用了 ButterKnife 依赖库 开始环境 ...
相关推荐
Android 悬浮按钮 悬浮框 浮动按钮Android 悬浮按钮 悬浮框 浮动按钮Android 悬浮按钮 悬浮框 浮动按钮Android 悬浮按钮 悬浮框 浮动按钮
android 自定义 单选按钮 radioButton
android2.3旋转按钮驱动,功能为上,下确认
android 仿音量旋转按钮,就是可以旋转的
android 圆形旋转按钮实现,类似圆盘,可以滑动旋转。
点击单箭头刷新按钮后,按钮变成旋转的圆圈。
Android 悬浮按钮 悬浮框 浮动按钮
按钮特效
android switch 切换开关按钮
android 自定义好看的开关按钮 android 自定义好看的开关按钮
自定义UI,实现了转盘样式按钮,多功能按钮。 此控件可以设置 按钮的图片,按钮的数量,还有背景,样式,分割线的宽度,还有对称轴。
Android 桌面漂浮按钮 直接拖动
使用Android完全自定义控件,继承自View,Canvas绘制。
Android例子源码按钮旋转和动态上推menu效果
Android 拖拽悬浮按钮
android基础-按钮点击
Android自定义按钮,实现长按处理的功能 详情见http://blog.csdn.net/huahuadashen/article/details/17711551
仿IOS写的一个水波类型的按钮,自带androidL的水波效果和按钮缩放效果
android 悬浮按钮切换页面。 点击窗口,显示按钮。然后按钮慢慢消失。 点按钮,切换页面。
Android悬浮菜单按钮FloatingActionButton实现,可直接拿到项目中集成使用,希望给大家带来帮助