首页 文章 精选 留言 我的

精选列表

搜索[手机],共10000篇文章
优秀的个人博客,低调大师

js判断是否是pc端打开还是手机端打开

根据浏览器头判断是使用神马设备打开的网页 <script type="text/javascript"> function is_mobile() { var regex_match = /(nokia|iphone|android|motorola|^mot-|softbank|foma|docomo|kddi|up.browser|up.link|htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|blackberry|alcatel|amoi|ktouch|nexian|samsung|^sam-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|symbian|smartphone|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte-|longcos|pantech|gionee|^sie-|portalmmm|jigs browser|hiptop|^benq|haier|^lct|operas*mobi|opera*mini|320x320|240x320|176x220)/i; var u = navigator.userAgent; if (null == u) { return true; } var result = regex_match.exec(u); if (null == result) { return false } else { return true } } if (is_mobile()) { document.location.href = 'https://www.baidu.com/'; }else { document.location.href = 'https://www.baidu.com/'; } </script> 欢迎访问我的个人博客–付博瀚的个人博客

优秀的个人博客,低调大师

Android--跳转到各大手机品牌权限管理界面

版权声明:本文为博主原创文章,转载请标明出处。 https://blog.csdn.net/chaoyu168/article/details/80280200 /** * 跳转设置页面 */ import android.app.Activity; import android.content.ComponentName; import android.content.Intent; import android.net.Uri; import android.os.Build; import android.provider.Settings; import android.support.v7.appcompat.BuildConfig; import android.util.Log; public class JumpPermissionManagement { /** * Build.MANUFACTURER */ private static final String MANUFACTURER_HUAWEI = "Huawei";//华为 private static final String MANUFACTURER_MEIZU = "Meizu";//魅族 private static final String MANUFACTURER_XIAOMI = "Xiaomi";//小米 private static final String MANUFACTURER_SONY = "Sony";//索尼 private static final String MANUFACTURER_OPPO = "OPPO"; private static final String MANUFACTURER_LG = "LG"; private static final String MANUFACTURER_VIVO = "vivo"; private static final String MANUFACTURER_SAMSUNG = "samsung";//三星 private static final String MANUFACTURER_LETV = "Letv";//乐视 private static final String MANUFACTURER_ZTE = "ZTE";//中兴 private static final String MANUFACTURER_YULONG = "YuLong";//酷派 private static final String MANUFACTURER_LENOVO = "LENOVO";//联想 /** * 此函数可以自己定义 * @param activity */ public static void GoToSetting(Activity activity){ switch (Build.MANUFACTURER){ case MANUFACTURER_HUAWEI: Huawei(activity); break; case MANUFACTURER_MEIZU: Meizu(activity); break; case MANUFACTURER_XIAOMI: Xiaomi(activity); break; case MANUFACTURER_SONY: Sony(activity); break; case MANUFACTURER_OPPO: OPPO(activity); break; case MANUFACTURER_LG: LG(activity); break; case MANUFACTURER_LETV: Letv(activity); break; default: ApplicationInfo(activity); Log.e("goToSetting", "目前暂不支持此系统"); break; } } public static void Huawei(Activity activity) { Intent intent = new Intent(); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra("packageName", BuildConfig.APPLICATION_ID); ComponentName comp = new ComponentName("com.huawei.systemmanager", "com.huawei.permissionmanager.ui.MainActivity"); intent.setComponent(comp); activity.startActivity(intent); } public static void Meizu(Activity activity) { Intent intent = new Intent("com.meizu.safe.security.SHOW_APPSEC"); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.putExtra("packageName", BuildConfig.APPLICATION_ID); activity.startActivity(intent); } public static void Xiaomi(Activity activity) { Intent intent = new Intent("miui.intent.action.APP_PERM_EDITOR"); ComponentName componentName = new ComponentName("com.miui.securitycenter", "com.miui.permcenter.permissions.AppPermissionsEditorActivity"); intent.setComponent(componentName); intent.putExtra("extra_pkgname", BuildConfig.APPLICATION_ID); activity.startActivity(intent); } public static void Sony(Activity activity) { Intent intent = new Intent(); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra("packageName", BuildConfig.APPLICATION_ID); ComponentName comp = new ComponentName("com.sonymobile.cta", "com.sonymobile.cta.SomcCTAMainActivity"); intent.setComponent(comp); activity.startActivity(intent); } public static void OPPO(Activity activity) { Intent intent = new Intent(); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra("packageName", BuildConfig.APPLICATION_ID); ComponentName comp = new ComponentName("com.color.safecenter", "com.color.safecenter.permission.PermissionManagerActivity"); intent.setComponent(comp); activity.startActivity(intent); } public static void LG(Activity activity) { Intent intent = new Intent("android.intent.action.MAIN"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra("packageName", BuildConfig.APPLICATION_ID); ComponentName comp = new ComponentName("com.android.settings", "com.android.settings.Settings$AccessLockSummaryActivity"); intent.setComponent(comp); activity.startActivity(intent); } public static void Letv(Activity activity) { Intent intent = new Intent(); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra("packageName", BuildConfig.APPLICATION_ID); ComponentName comp = new ComponentName("com.letv.android.letvsafe", "com.letv.android.letvsafe.PermissionAndApps"); intent.setComponent(comp); activity.startActivity(intent); } /** * 只能打开到自带安全软件 * @param activity */ public static void _360(Activity activity) { Intent intent = new Intent("android.intent.action.MAIN"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra("packageName", BuildConfig.APPLICATION_ID); ComponentName comp = new ComponentName("com.qihoo360.mobilesafe", "com.qihoo360.mobilesafe.ui.index.AppEnterActivity"); intent.setComponent(comp); activity.startActivity(intent); } /** * 应用信息界面 * @param activity */ public static void ApplicationInfo(Activity activity){ Intent localIntent = new Intent(); localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (Build.VERSION.SDK_INT >= 9) { localIntent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS"); localIntent.setData(Uri.fromParts("package", activity.getPackageName(), null)); } else if (Build.VERSION.SDK_INT <= 8) { localIntent.setAction(Intent.ACTION_VIEW); localIntent.setClassName("com.android.settings", "com.android.settings.InstalledAppDetails"); localIntent.putExtra("com.android.settings.ApplicationPkgName", activity.getPackageName()); } activity.startActivity(localIntent); } /** * 系统设置界面 * @param activity */ public static void SystemConfig(Activity activity) { Intent intent = new Intent(Settings.ACTION_SETTINGS); activity.startActivity(intent); } }

优秀的个人博客,低调大师

android-手机内存分配和回收机制研究

Theory: There are two kinds ofmemory allocationmechanism : (1)Somelargeapplication ,like oracle client ,world of warcraft game : ( We can think about it likeBuffet(自助餐),if you paid, you can control what you eat and do not need to pay anymore ) This kind of application will have aminimum configurationof memory ( for example ,the WOW game will have at least 1gigabyte memory) ,this minimum memory is the largest estimation of the memory that it may use,it will never ask the Operation System for extra memory when runningit .(For example ,the wow.exe only need 400m memory ,the left memory are reserved for temp files ,swap files ,object files and so on ,so even it only needs 400M,the rest 600M are unavailable for other application .) So this kind of application has only two status: (Can run / cannot run),Once it runs ,it will always run and do not need to worry about the memory . (2)Small application: Most of the normal application are acted like this way ,it applies for a small memory ,and when it runs and needs more memory ,it asked the Operation system for more memory. (we can think it as “Choose dishes from menu”(点菜),if we needs more ,we order more ,pay more) So this kind of application will have three status: (cannot run /Can run/ can run but future the memory used out) During running ,it needs more memory and applied from OS ,so maybe onetime ,the OS cannot supply enough memory, this application will shutdown. Our issue: Based on the above theory ,we can take a look at the problem ,why sometimes ,the application will shut down if we scroll the screen very frequently in search result page. Because android mobile application is usingMechanism 2 Problem:when we go to the search result page ,if we scroll down the screen very frequently ,the application thread will shut down because of the memory used out. Phenomenon: scroll down very frequently ->Dalvik VM used out exception Reason: The Heap memory can be divided into parts,one is reserved for java objects ,the other is reserved for native C objects.(They cannot mix together) If we scroll up /down the screen very frequently ,the new native objects are created andONLY the native heap memory are recycled. And the recycling speed is much slower than the allocating memory speed ,that’s why the heap memory will used out. From the log ,we can see ,that only native heap memory are recycled (GC_EXTERNAL_ALLOC stands for the native heap memory recycle) And most the memory recycled are small( less than 150KB) ,that’s because android based on “slab” mechanism to allocate memory ,and the slab has a limit size. But what the size of the native heap memory it allocated when a new native c object created? The answer is320KBin our test So,allocate more and recycle less ,at last ,the memory will used out and the application process will die. Solution; When configure the emulator ,pleaseset the RAM(SD card) to be a large number ,and restart the emulator. Go to <ANDROID_ROOT>\.android\avd\<Your avd>\config.ini ,change thesdcard.size 本文转自 charles_wang888 51CTO博客,原文链接:http://blog.51cto.com/supercharles888/835923,如需转载请自行联系原作者

资源下载

更多资源
优质分享App

优质分享App

近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。

Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

用户登录
用户注册
修改密码
忘记密码