科技: 人物 企业 技术 IT业 TMT
科普: 自然 科学 科幻 宇宙 科学家
通信: 历史 技术 手机 词典 3G馆
索引: 分类 推荐 专题 热点 排行榜
互联网: 广告 营销 政务 游戏 google
新媒体: 社交 博客 学者 人物 传播学
新思想: 网站 新书 新知 新词 思想家
图书馆: 文化 商业 管理 经济 期刊
网络文化: 社会 红人 黑客 治理 亚文化
创业百科: VC 词典 指南 案例 创业史
前沿科技: 清洁 绿色 纳米 生物 环保
知识产权: 盗版 共享 学人 法规 著作
用户名: 密码: 注册 忘记密码?
    创建新词条
科技百科
  • 人气指数: 1314 次
  • 编辑次数: 1 次 历史版本
  • 更新时间: 2011-12-12
高兴
高兴
发短消息
相关词条
《连通目标2020议程》
《连通目标2020议程》
美国增长最快的十个职业
美国增长最快的十个职业
盘点全球十四家大数据公司
盘点全球十四家大数据公司
终结互联网历史的10大流言
终结互联网历史的10大流言
盘点万维网十件事
盘点万维网十件事
万维网25年历程回顾
万维网25年历程回顾
万维网改变世界的25个方式
万维网改变世界的25个方式
2014年互联网七大关键趋势
2014年互联网七大关键趋势
2013年全球十大互联网城市排行榜
2013年全球十大互联网城市排行榜
2013年互联网十大技术趋势
2013年互联网十大技术趋势
推荐词条
希拉里二度竞选
希拉里二度竞选
《互联网百科系列》
《互联网百科系列》
《黑客百科》
《黑客百科》
《网络舆情百科》
《网络舆情百科》
《网络治理百科》
《网络治理百科》
《硅谷百科》
《硅谷百科》
2017年特斯拉
2017年特斯拉
MIT黑客全纪录
MIT黑客全纪录
桑达尔·皮查伊
桑达尔·皮查伊
阿里双十一成交额
阿里双十一成交额
最新词条

热门标签

微博侠 数字营销2011年度总结 政务微博元年 2011微博十大事件 美国十大创业孵化器 盘点美国导师型创业孵化器 盘点导师型创业孵化器 TechStars 智能电视大战前夜 竞争型国企 公益型国企 2011央视经济年度人物 Rhianna Pratchett 莱恩娜·普莱契 Zynga与Facebook关系 Zynga盈利危机 2010年手机社交游戏行业分析报告 游戏奖励 主流手机游戏公司运营表现 主流手机游戏公司运营对比数据 创建游戏原型 正反馈现象 易用性设计增强游戏体验 易用性设计 《The Sims Social》社交亮 心理生理学与游戏 Kixeye Storm8 Storm8公司 女性玩家营销策略 休闲游戏的创新性 游戏运营的数据分析 社交游戏分析学常见术语 游戏运营数据解析 iPad风行美国校园 iPad终结传统教科书 游戏平衡性 成长类型及情感元素 鸿蒙国际 云骗钱 2011年政务微博报告 《2011年政务微博报告》 方正产业图谱 方正改制考 通信企业属公益型国企 善用玩家作弊行为 手机游戏传播 每用户平均收入 ARPU值 ARPU 游戏授权三面观 游戏设计所运用的化学原理 iOS应用人性化界面设计原则 硬核游戏 硬核社交游戏 生物测量法研究玩家 全球移动用户 用户研究三部曲 Tagged转型故事 Tagged Instagram火爆的3大原因 全球第四大社交网络Badoo Badoo 2011年最迅猛的20大创业公司 病毒式传播功能支持的游戏设计 病毒式传播功能 美国社交游戏虚拟商品收益 Flipboard改变阅读 盘点10大最难iPhone游戏 移动应用设计7大主流趋势 成功的设计文件十个要点 游戏设计文件 应用内置付费功能 内置付费功能 IAP功能 IAP IAP模式 游戏易用性测试 生理心理游戏评估 游戏化游戏 全美社交游戏规模 美国社交游戏市场 全球平板电脑出货量 Facebook虚拟商品收益 Facebook全球广告营收 Facebook广告营收 失败游戏设计的数宗罪名 休闲游戏设计要点 玩游戏可提高认知能力 玩游戏与认知能力 全球游戏广告 独立开发者提高工作效率的100个要点 Facebook亚洲用户 免费游戏的10种创收模式 人类大脑可下载 2012年最值得期待的20位硅谷企业家 做空中概股的幕后黑手 做空中概股幕后黑手 苹果2013营收 Playfish社交游戏架构

10种可提升Android应用运行效果的技巧 发表评论(0) 编辑词条

目录

10种可提升Android应用运行效果的技巧编辑本段回目录

随着手机平台的发展和所提供应用的提升,质量成为应用成功的最重要因素。如果那些应用无法提供强大的功能和稳定的用户体验,那就会很快被用户卸载。开发者需要记住的是,虽然Android智能手机和平板电脑的速度日益提升,但其应用仍然运行在资源有限的环境中,其电池及处理器性能与最新的台式电脑、手提电脑仍存在差距。以下是某些优化应用运行效果的方法:

我们先来阐述某些让应用反应灵敏的编程技巧。

android_development(from apalon)

android_development(from apalon)

技巧1:从优秀的编程开始

要采用已为用户所接受的运算法则和标准的设计样式,这些被人们长期使用的编程法则也同样适用于Android应用,尤其当这些应用使用内在设备服务时。

比如,假设你编写的应用需要以地理定位服务为基础。只需要在必要时开始注册进行位置更新,在无需更新信息时,确保应用停止更新进程。这会帮助节省设备的电量和系统处理器的负担。

技巧2:保持应用的灵活性

通过使用AsyncTask、IntentService或自定义背景服务来保持应用的灵活性。使用加载器来简化加载时间较长数据的状态管理,比如光标。不可让应用在其他进程进行时显得缓慢或完全静止。

如果某些操作需要一定的时间和资源,应当将这个进程单独分离出来异步处理,这样你的应用才能够保持流畅的运行。可以运用这种方法的操作包括:磁盘读写,访问内容供应方、数据库和网络,其他需要较长时间的任务。

技巧3:使用最新的Android SDK版本和API

保持应用的更新,使用Android平台提供的最新内容。随着Android平台的发展,它也在逐步改善中。某些功能被移除,或者替换成更好的选项。其核心API中的漏洞已修复,整个API性能已得到提升。该平台已引入装载器之类的新API,帮助开发者编写更为稳定和反应灵敏的应用。

Android 3.0应用支持硬件加速,你可以加以应用。应当理解的是,最佳的表现情况会随着时间逐渐改变。睿智的开发者会更新平台发布的最新内容和API。

技巧4:检查Strict Mode

你可以使用称为“StrictMode”的Android API来查找编程中的问题。StrictMode会帮助你识别应用是否正在耗费内存,也可以帮你检查应用是否正在尝试开展漫长的模块化操作。

StrictMode类(游戏邦注:即android.os.StrictMode)与Android 2.3同期发布。

技巧5:在发布之前停用或最小化调试和诊断

你在Android应用的开发中可能会将某些调试代码构建其中。在应用发布之前确保这些功能被最小化或完全停用。

接下来,让我们来讨论如何用优秀的用户界面设计原则让你的应用加载速度更快。

技巧6:保持布局简洁自然

简洁自然的布局会加快加载速度。不要让屏幕布局中充斥过多不必要的内容。花点时间开发用户可以有效使用的简洁用户界面,不要将过多的功能性内容塞入单个屏幕中。这不仅对应用表现有帮助,而且会帮助用户更有效地使用应用。

分割内容可以帮助划分用户界面功能性,同时不牺牲应用在各种不同设备上的灵活性。

技巧7:根据目标设备调整应用资源

根据特定的设备配置来调整资源,这样它们就能够有效地加载。在图像资源方面,这个显得尤为重要。如果你的应用中有大型的图片资源需要加载,那么要做好调整。

另一个技巧是,当以许多种设备为目标时,保持应用包文件大小合适,只需要在其中包含应用运行所需的核心资源即可,然后让用户根据具体设备下载应用其他内容。

技巧8:使用Hierarchy Viewer工具

Hierarchy Viewer工具可以帮助你解除应用布局中的漏洞。它还提供了许多有价值的信息,比如每个View控制需要多长的时间。找到问题所属领域,这样解决问题会更加简单。

技巧9:使用layoutopt工具

layoutopt工具是个简单的命令行工具,可以帮助你识别不必要的控制和其他让你布局资源崩溃的事项,提升其性能。它可以帮助你找到不必要的多余布局控制。较少和较浅布局可优化应用运行性能。

最后,在自认为应用达到最好状况时,对其进行测试。

技巧10:使用Traceview和其他Android应用压缩工具

Android SDK中有许多可以压缩应用的工具。可能最流行的工具就是Traceview,这个图像工具可以帮助你调试和找到应用的性能问题。

结语

目前有许多方法可以让你的Android应用运行加速。有些涉及到使用某种具体的运算法则,其他依靠某些真正的调试和运行监管技术。Android平台中有许多种免费的工具可以用来帮助跟踪和调整应用中的表现问题。你已经知道了以上10种技巧,现在可以尝试使用它们!(本文为游戏邦/gamerboom.com编译,作者:Lauren Darcey & Shane Conder)

10 Android App Performance Tips for Developers

Lauren Darcey & Shane Conder

As any mobile platform evolves and its application offerings improve, quality becomes paramount to success. These days, users demand responsiveness and reasonable performance from the Android applications they choose to install on their devices. And if those applications fail to deliver both exciting functionality and a stable user experience, then the application is quickly uninstalled.

Although Android smartphones and tablets are getting faster every day, developers need to remember that their applications are still running in a resource-constrained environment powered primarily by battery and processors that do not rival the latest desktops or laptops. Here are some ways to slim down your applications so they run optimally on the Android devices of today and tomorrow.

Let’s start with some coding tips for responsive applications.

Android App Performance Tip #1: Start with Good Coding Practices

Be a good steward and use common sense, well-established algorithms and standard design patterns. Resource-wise, if you open it, close it. Acquire late, release early. These long-standing coding mantras apply to your Android applications as well, especially if they use underlying device services.

For example, let’s say you’ve written an application that relies upon location-based services. Don’t start register for location updates until you absolutely have to, and make sure you un-register for updates as soon as you no longer need the information. This will help you not drain the device battery or hog the system unnecessarily.

Android App Performance Tip #2: Keep Blocking Operations Off the Main UI Thread

Keep your applications nimble by using an AsyncTask, thread, IntentService, or custom background service to do the dirty work. Use loaders to simplify state management of long loading data, such as cursors. You cannot afford for your application to lag or freeze while some processing is going on.

If an operation takes time and resources, offload that processing and perform it asynchronously so that your application remains responsive and the user can go about their business. This applies to operations such as: reading and writing to disk, accessing content providers, databases and the Internet, as well as parsing and other lengthy tasks.

Android App Performance Tip #3: Use the Latest Android SDK Versions, APIs and Best Practices

Keep your applications up-to-date and using the latest that the Android platform has to offer. As the Android platform evolves, it is improved. Some features may be retired, or replaced with better options. Core APIs receive bug fixes and performance improvements. New APIs like loaders have been introduced to help developers write more stable and responsive applications.

Did you know you can enable hardware acceleration in your Android 3.0 apps? Do it! Understand that best practices change over time. Smart developers stay on top of what’s new in the platform and what’s no longer recommended.

Android App Performance Tip #4: Check Out Strict Mode

You can use an Android API called StrictMode to help you track down violations in several good coding practices. StrictMode will help you identify if your application is leaking memory, as well as detect whether or not your application is trying to perform lengthy blocking operations that should be offloaded to threads or otherwise (see #2).

The StrictMode class (android.os.StrictMode) was introduced in Android 2.3.

Android App Performance Tip #5: Disable or Minimize Debugging and Diagnostics Prior to Publication

If your Android application has taken more than a few minutes to develop, you’ve probably got some logging and debugging code built into your application. Writing to logs and other such output comes at a performance hit. Make sure these features are minimized or completely disabled prior to release.

Now let’s talk about how to make your application screens load faster with good user interface design principles:

Android App Performance Tip #6: Keep Your Layouts Simple, Elegant, and Shallow

Simple screens make for the easiest reading and simple layouts load the fastest. You don’t want to nest your layouts too deeply or clutter your screens with more View controls than absolutely necessary. Spend the time to develop elegant user interfaces that users can use effectively instead of trying to cram too much functionality onto a single screen. Not only will this help application performance, but it will help make your application more efficient for users.

Fragments can help compartmentalize user interface functionality without sacrificing flexibility for designing for different types of devices.

Android App Performance Tip #7: Tailor Your Application Resources To Your Target Devices

Include resources that are tailored to specific device configurations, so that they load as efficiently as possible. This is especially important when we’re talking about graphics resources. If you include huge drawable image resources that require loading and resizing, you’re not using alternative application resources effectively.

Another trick? To keep your application package file reasonably sized when targeting many devices, only include core resources needed to run the application initially, then have the application download content tailored to the device.

Android App Performance Tip #8: Use the Hierarchy Viewer Tool

The Hierarchy Viewer tool helps you debug your application layouts. It also provides valuable profiling information about how long it takes each View control within a layout to measure, render, and draw. Pinpoint problem areas and fix them easily.

Android App Performance Tip #9: Use the layoutopt Tool

The layoutopt tool is a simple command-line tool that can help you identify unnecessary nesting of controls and other ways to collapse your layout resources to make them as slim as possible. It will give you hints on what layout controls may be redundant or unnecessary. Fewer controls and shallower layouts perform better.

And finally… So you think your app is the best it can be? Now it’s time to put it to the test.

Android App Performance Tip #10: Use Traceview and Other Android Tools for Profiling

The Android SDK comes with a number of tools for profiling your applications. Perhaps the most popular tool is Traceview, a graphical tool that can help you debug and find performance bottlenecks in your apps. Check out some debugging tools discussed in the Android documentation.

Conclusion

There are many ways to speed up the performance of your Android applications. Some involve using specific algorithms and others rely upon tried and true debugging and performance monitoring techniques. Luckily, the Android platform comes with numerous free utilities to help track down and eradicate performance problems within your applications. You’ve got ‘em, now use ‘em! (Source: devoloper.com)

→如果您认为本词条还有待完善,请 编辑词条

词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。
0

标签: 10种可提升Android应用运行效果的

收藏到: Favorites  

同义词: 暂无同义词

关于本词条的评论 (共0条)发表评论>>

对词条发表评论

评论长度最大为200个字符。