Updated on 2016/1/6 修正了一些翻译段落欢迎转载,但请保留译者链接:http://www.jianshu.com/p/613d28a3c8a0 Lessons learned from Android developers in Futurice. Avoid reinventing the wheel by following these guidelines. If you are interested in iOS or Windows Phone development…
在Android开发过程中,常需要更新界面的UI.而更新UI是要主线程来更新的,即UI线程更新.如果在主线线程之外的线程中直接更新页面 显示常会报错.抛出异常:android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. 只有原始创建这个视图层次(view hierachy)的线程才能修改它的视图(v…
1.从google搜索内容 Intent intent = new Intent(); intent.setAction(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY,"searchString") startActivity(intent); 2.浏览网页 Uri uri = Uri.parse("http://www.google.com"); Intent it = new Int…
Best practices in Android development Use Gradle and its recommended project structure 使用Gradle和其推荐的工程结构 Put passwords and sensitive data in gradle.properties 将密码和敏感数据放置在gradle.properties中 Don't write your own HTTP client, use Volley or OkHttp librar…
Google Developing for Android 二 - Memory 最佳实践 | 分类于 Android最佳实践 原文:Developing for Android, II The Rules: Memory 在决定应用的行为,是否有好的用户体验以及整体的设备体验来说,内存的使用可能是独立因素中最重要的.内存因素包括应用的内存占用,以及内存搅动(导致的垃圾回收会对运行期间的性能有影响). 避免在循环中分配内存 内存分配虽然不可避免,但是应尽可能的避免,特别是在平凡的调用的代…