android develop
文章平均质量分 71
sadsadsadsadsazcAS
这个作者很懒,什么都没留下…
展开
-
09Creating a Fragment
You can think of a fragment as a modular section of an activity, which has its own lifecycle, receives its own input events, and which you can add or remove while the activity is running (sort of like原创 2014-12-10 09:27:58 · 396 阅读 · 0 评论 -
开源框架Android-Universal-Image-Loader
Android-Universal-Image-Loader的github地址为:https://github.com/nostra13/Android-Universal-Image-Loader 正如他的github上的主页上的介绍:Powerful and flexible library for loading, caching and displaying images on A原创 2014-12-26 14:30:13 · 849 阅读 · 0 评论 -
84Android drawable-nodpi 的作用
把一些不能被拉伸的图片放在 drawable-nodpi 中,此图片将不会被放大,以原大小显示。看下图:drawable-nodpi 的作用" title="Android drawable-nodpi 的作用" style="margin:0px; padding:0px; border:0px; list-style:none">这两个图片被放到了dra转载 2015-02-02 15:09:25 · 674 阅读 · 0 评论 -
android中string.xml中%1$s、%1$d等的用法
今天看源码的时候,在string.xml文件中遇到了这个: 实际中如下:原来是:Xliff,Xliff是XML Localization Interchange File Format 的缩写,中文名为XML本地化数据交换格式一、使用xliff的用法:标签介绍: 属性id可以随便命名 属性值举例说明%n$ms:代表输出的是字符原创 2014-12-26 16:56:22 · 1120 阅读 · 0 评论 -
17Allowing Other Apps to Start Your Activity
The previous two lessons focused on one side of the story: starting another app's activity from your app. But if your app can perform an action that might be useful to another app, your app should be原创 2014-12-27 09:03:45 · 563 阅读 · 0 评论 -
16Sending the User to Another App(隐式Intent意图)
One of Android's most important features is an app's ability to send the user to another app based on an "action" it would like to perform. For example, if your app has the address of a business that原创 2014-12-27 08:22:24 · 522 阅读 · 0 评论 -
18Getting a Result from an Activity
本篇主要介绍startActivityForResult()方法和onActivityResult()方法。其中startActivityForResult()接受两个参数,一个是请求码,一个是Intent;onActivityResult()接受三个参数,一个是请求码,一个是返回的结果码,一个是Intent;Starting another activity doesn'原创 2014-12-27 09:09:01 · 583 阅读 · 0 评论 -
19Controlling Your App’s Volume and Playback
A good user experience is a predictable one. If your app plays media it’s important that your users can control the volume of your app using the hardware or software volume controls of their device, b原创 2014-12-29 10:18:29 · 531 阅读 · 0 评论 -
29Android数据过滤机制
1.何谓Android的过滤机制? Android对数据的处理是分层的,从上到下,可以分为:数据层、提供层、Cursor层、适配层、显示层。每个层次通过一定的机制,可以使数据发生变化时能够上下通知。如下: 显示层(ListView,GridView,AutoCompleteTextView等) 适配层(Adpater) Cursor层(Cur原创 2014-12-30 15:20:28 · 1078 阅读 · 0 评论 -
38SparseIntArray的使用
在通讯录联系人列表界面,使用SparseIntArray来定义positionOfSection,和sectionOfPosition,为什么这样定义呢?看下SparseIntArray的API说明:SparseIntArrays map integers to integers. Unlike a normal array of integers, there can be gaps原创 2014-12-31 16:11:56 · 817 阅读 · 0 评论 -
Application Fundamentals
Application FundamentalsAndroid apps are written in the Java programming language. The Android SDK tools compile your code—along with any data and resource files—into an APK: an Android package, whi翻译 2015-01-12 08:37:38 · 515 阅读 · 0 评论 -
AndroidAnnotations开源框架
这段时间学习别人的源码,需要AndroidAnnotations这个开源的框架,学习下,他的地在:https://github.com/excilys/androidannotations文档的地址在:https://github.com/excilys/androidannotations/wiki 正如在github上他的主页上所说:Fast Android Development.原创 2014-12-26 14:11:58 · 1750 阅读 · 0 评论 -
15AsyncTask
Class OverviewAsyncTask enables proper and easy use of the UI thread. This class allows to perform background operations and publish results on the UI thread without having to manipulate thr原创 2014-12-26 09:38:59 · 491 阅读 · 0 评论 -
10Building a Flexible UI
When designing your application to support a wide range of screen sizes, you can reuse your fragments in different layout configurations to optimize the user experience based on the available screen s原创 2014-12-10 09:33:36 · 451 阅读 · 0 评论 -
Managing Bitmap Memory
In addition to the steps described in Caching Bitmaps, there are specific things you can do to facilitate garbage collection and bitmap reuse. The recommended strategy depends on which version(s) of原创 2015-02-02 14:39:38 · 618 阅读 · 0 评论 -
Displaying Bitmap小结
Google的关于展示位图的课程学习完毕了。主要的内容主要包括了下面的几个部分:1.高效的加载大图(Loading Large Bitmaps Efficiently)2.非UI线程处理Bitmap(Processing Bitmaps Off the UI Thread)3.缓存Bitmaps(Caching Bitmaps)(LruCache和DiskLruCache,原创 2015-02-02 14:42:06 · 589 阅读 · 0 评论 -
Processing Bitmaps Off the UI Thread
The BitmapFactory.decode* methods, discussed in the Load Large Bitmaps Efficiently lesson, should not be executed on the main UI thread if the source data is read from disk or a network location (原创 2015-02-02 14:38:29 · 679 阅读 · 0 评论 -
Displaying Bitmaps in Your UI
This lesson brings together everything from previous lessons, showing you how to load multiple bitmaps intoViewPager and GridView components using a background thread and bitmap cache, while dealing原创 2015-02-02 14:40:16 · 603 阅读 · 0 评论 -
11Communicating with Other Fragments(Fragment之间的通信)
In order to reuse the Fragment UI components, you should build each as a completely self-contained, modular component that defines its own layout and behavior. Once you have defined these reusable Fra原创 2014-12-26 08:19:20 · 727 阅读 · 0 评论 -
12Saving Key-Value Sets(SharedPreferences的使用)
If you have a relatively small collection of key-values that you'd like to save, you should use the SharedPreferences APIs. ASharedPreferences object points to a file containing key-value pairs an原创 2014-12-26 08:36:42 · 408 阅读 · 0 评论 -
13Saving Files(保存文件到手机内存和外存储设备上)
Android uses a file system that's similar to disk-based file systems on other platforms. This lesson describes how to work with the Android file system to read and write files with the FileAPIs.A原创 2014-12-26 08:48:19 · 933 阅读 · 0 评论 -
14Saving Data in SQL Databases(使用SQLite数据库)
Saving data to a database is ideal for repeating or structured data, such as contact information. This class assumes that you are familiar with SQL databases in general and helps you get started with原创 2014-12-26 09:23:29 · 967 阅读 · 0 评论 -
94手机杀毒的逻辑实现
最终实现的效果如下:扫描完毕之后:第一步:首先获取每个文件的(apk文件)的MD5值:/** * 获取文件的MD5值 * * @param path * 文件的全路径名称 * @return */ private String getFileMd5(String path) { File file = new Fi原创 2014-12-31 20:28:34 · 691 阅读 · 0 评论 -
95横竖屏切换导致Activity生命周期变化对杀毒的影响
当屏幕横竖屏切换的时候,Activity会被销毁,重新创建Activity,当用户正在杀毒的时候,横竖屏切换了,那么会重新去杀毒,这样用户体验不好,解决的办法很简单,只要在清单文件下的该Activity的配置中增加下面的属性:android:configChanges="orientation|keyboardHidden|screenSize"指定屏幕的方向,软键盘,屏幕的大小不会影响A原创 2014-12-31 20:45:47 · 498 阅读 · 0 评论 -
97去掉ScrollVIew拉到尽头时再拉的阴影效果
一、删除android ScrollView边界阴影方法方法 1) 在xml中添加:android:fadingEdge=”none” 2) 代码中添加:ScrollView.setHorizontalFadingEdgeEnabled(false); 二、删除ScrollView拉到尽头(顶部、底部),然后继续拉出现的阴影效果 适用于2.3及以上的 否则不用设置原创 2014-12-31 21:00:30 · 655 阅读 · 0 评论 -
高效显示Bitmap3--->Cached Bitmap
加载单个Bitmap到UI是简单直接的,但是如果你需要一次加载大量的图片,事情则会变得复杂起来。在大多数情况下(例如在使用ListView,GridView或ViewPager时), 屏幕上的图片和因滑动将要显示的图片的数量通常是没有限制的。通过循环利用子视图可以抑制内存的使用,GC(garbage collector)也会释放那些不再需要使用的bitmap。这些机制都非常好,但是为了保持一个原创 2015-01-21 15:51:14 · 1158 阅读 · 0 评论 -
41右侧字母索引栏的编写
实现的效果图:通过自定义View,然后在xml文件中引用可以达到需求。public SiderBar(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; init(); } private String[] sections = new Stri原创 2015-01-04 11:31:53 · 756 阅读 · 0 评论 -
42android:duplicateParentState="true"
API给的解释是:When this attribute is set to true, the view gets its drawable state (focused, pressed, etc.) from its direct parent rather than from itself. [boolean]。当这个属性设置为true的时候,view对象从他的直接父类获取他的dra原创 2015-01-04 14:00:10 · 805 阅读 · 0 评论 -
Android知识点(两种单例)
1.什么是状态机?项目中什么时候用到状态机,举例说明。(了解)--->关于状态机的一个极度确切的描述是它是一个有向图形,由一组节点和一组相应的转移函数组成。状态机通过响应一系列事件而“运行”。每个事件都在属于“当前” 节点的转移函数的控制范围内,其中函数的范围是节点的一个子集。函数返回“下一个”(也许是同一个)节点。这些节点中至少有一个必须是终态。当到达终态, 状态机停止。群里一哥们的解释原创 2015-01-05 10:57:46 · 568 阅读 · 0 评论 -
Android组件设计思想
内容来自罗升阳的PPT从四个方面说起:组件化背景组件化设计组件化支持一、组件化背景从PC客户端应用程序说起:开发者角度复杂,同时兼顾UI、交互和业务逻辑运行载体是进程进程只有一个入口点—main使用者角度流畅的UI、友好的交互、正确的结果不知进程是何物//===========================PC客户端应用程序原创 2015-01-05 14:09:37 · 1147 阅读 · 0 评论 -
81ACTION_GET_CONTENT和ACTION_PICK的区别
即时通讯做到选择图片的功能:我是这样处理的: public void selectPicFromLocal() { Intent intent; if (Build.VERSION.SDK_INT < 19) { intent = new Intent(Intent.ACTION_GET_CONTENT); int原创 2015-01-23 09:34:28 · 3687 阅读 · 0 评论 -
eclipse下如何关联android-support-v4.jar源码
一、首先导入jar包如果android-support-v4.jar包在libs目录下,先将它移除。然后点选中项目右键 --->properties-->javabuildpath-->Libraries-->Add External JARs。选择你sdk目录下的\extras\android\compatibility\v4\android-support-v4.jar.点 击ok。这原创 2015-01-05 20:55:05 · 856 阅读 · 0 评论 -
Error inflating class android.support.v4.view.ViewPager 问题的解决方法
今天在使用ViewPager的时候遇到这样的一个错误:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dystu.viewpagerdemo/com.dystu.viewpagerdemo.MainActivity}: android.view.InflateException: Binary XM原创 2015-01-05 21:50:01 · 3047 阅读 · 1 评论 -
Custom Drawing
Override onDraw()The most important step in drawing a custom view is to override the onDraw() method. The parameter to onDraw() is a Canvasobject that the view can use to draw itself. The Ca原创 2015-03-11 08:56:19 · 540 阅读 · 0 评论 -
高效显示Bitmap2--->非UI线程处理Bitmap
当数据源是网络或者是磁盘时(或者是任何实际源不在内存的),这些方法都不应该在main UI 线程中执行。那些情况下加载数据是不可以预知的,它依赖于许多因素(从网络或者硬盘读取数据的速度, 图片的大小, CPU的速度, etc.)。如果其中任何一个任务卡住了UI thread, 系统会出现ANR的错误。使用 AsyncTask 在后台线程中处理bitmap并且演示了如何处理并发(concurre原创 2015-01-21 15:40:19 · 599 阅读 · 0 评论 -
79使用相机拍照
请求使用相机权限(Request Camera Permission)如果拍照是你的应用的必要功能,那么限制它在在Google Play中仅对有相机设备可见。为了让别人知道你的应用依赖照相机,在你的manifest文件中添加标签:<manifest xmlns:android="http://schemas.android.com/apk/res/android" package原创 2015-01-22 15:39:48 · 669 阅读 · 0 评论 -
45Fragment的onHiddenChanged方法
API的解释为:参见:public final boolean isHidden()如果该Fragment对象已经被隐藏,那么它返回true。默认情况下,Fragment是被显示的。能够用onHiddenChanged(boolean)回调方法获取该Fragment对象状态的改变,要注意的是隐藏状态与其他状态是正交的---也就是说,要把该Fragment对象显示给用户,原创 2015-01-04 14:46:21 · 8821 阅读 · 0 评论 -
31会话界面的适配器中的工具类---使用Spannable自定义TextView
Spannable是一个接口,其源码为:/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance原创 2014-12-31 08:22:16 · 633 阅读 · 0 评论 -
32Spannable的使用(Android显示html带图片 (表情开发))
Android中显示html文件要用Html.fromHtml(...)处理过的返回值,返回值可以成为setText()的参数。只显示带文本的html可以用下面的方法处理html文件。public static Spanned fromHtml (String source) 显示带图片的html要用下面的方法处理html文件。public static Spanned from原创 2014-12-31 08:36:55 · 852 阅读 · 0 评论 -
Google官方demo(displayingBitmaps)
在这个demo里面,他使用的是GridView(在Fragment中)来显示图片的缩略图,当点击缩略图的时候,显示大图,使用了DiskLruCache和AsyncTask。原创 2015-01-19 10:12:11 · 1191 阅读 · 0 评论