test

随笔分类 -  Android

摘要:对android:configChanges属性,一般认为有以下几点:1、不设置Activity的android:configChanges时,切屏会重新调用各个生命周期,切横屏时会执行一次,切竖屏时会执行两次2、设置Activity的android:configChanges="orient... 阅读全文
posted @ 2015-03-25 14:32 Lechance 阅读(256) 评论(0) 推荐(0)
摘要:写代码这么久了,今天才理解的更明白一些,关于LayoutInflater有两种使用方法, Inflater英文意思是膨胀,在android中大概是扩展填充的意思吧。LayoutInflater的作用类似于 findViewById(),不同点是LayoutInflater是用来找layout下... 阅读全文
posted @ 2015-03-21 17:22 Lechance 阅读(357) 评论(0) 推荐(0)
摘要:查看源码BitmapDrawable.java。BitmapDrawable有若干个构造方法。New BitmapDrawable(Bitmap bitmap)是早期的一个构造方法,在android 4.0已经过时,部分代码如下:this(new BitmapState(bitmap), null)... 阅读全文
posted @ 2015-02-12 12:04 Lechance 阅读(939) 评论(0) 推荐(0)
摘要:我们在Android开发中,使用SharedPreferences来共享一些小的配置数据是非常方便的。但是我发现在不同的版本上,SharedPreferences的表现情况并不是一样。我用的测试机是Android 2.3.3,程序的写入和读取都正常。但把相同的程序在Android 4.2上运行... 阅读全文
posted @ 2015-02-11 17:17 Lechance 阅读(1545) 评论(0) 推荐(0)
摘要:下面这些术语都是指屏幕的分辨率。VGA:Video Graphics Array,即:显示绘图矩阵,相当于640×480 像素;HVGA:Half-size VGA,即:VGA的一半,分辨率为480×320,像三星盖世Ace S5830就是使用这分辨率;QVGA:Quarter VGA,即:VGA的... 阅读全文
posted @ 2015-02-11 09:51 Lechance 阅读(315) 评论(0) 推荐(0)
摘要:SQLite的数据库本质上来讲就是一个磁盘上的文件,所以一切的数据库操作其实都会转化为对文件的操作,而频繁的文件操作将会是一个很好时的过程,会极大地影响数据库存取的速度。例如:向数据库中插入100万条数据,在默认的情况下如果仅仅是执行sqlite3_exec(db, “insert into nam... 阅读全文
posted @ 2015-02-10 16:21 Lechance 阅读(201) 评论(0) 推荐(0)
摘要:findbugs警告26个。主要有以下9类问题。1、Bug: Hard coded reference to an absolute pathnameBUG描述:This code constructs a File object using a hard coded to an absolute ... 阅读全文
posted @ 2015-02-10 14:14 Lechance 阅读(677) 评论(0) 推荐(0)
摘要:方式一,Running services通过手机上Running services的Activity查看,可以通过Setting->Applications->Running services进。关于Running services的详细内容请参考《Android中使用"running servic... 阅读全文
posted @ 2015-02-09 14:42 Lechance 阅读(571) 评论(0) 推荐(0)
摘要:一、隐式意图介绍显式意图我们前面已经提到,形如:Intent intent = new Intent();intent.setClass(this,Other.class);//此句表示显式意图,因为明确设置激活对象为Other类startActivity(intent);顾名思义,隐式意图就是在不... 阅读全文
posted @ 2015-02-09 11:18 Lechance 阅读(8116) 评论(0) 推荐(0)
摘要:在开发过程中我们希望看到textview中内容过长的话自动换行,但是调用measureText函数时发现返回值很不准确,单位也不确定,是pixel还是dip,都不准。后来想起textview中有个内容过长加省略号的属性,即ellipsize,可以较偷懒地解决这个问题,哈哈~用法如下:在xml中... 阅读全文
posted @ 2015-02-05 11:47 Lechance 阅读(634) 评论(0) 推荐(0)
摘要:搞了半天android,竟然对external下的库一无所知?不能容忍!马上解决:android-mock:编译为java静态库。说明:Android Mock is a framework for mocking interfaces and classes on the Dalvik VM。资料... 阅读全文
posted @ 2015-02-05 08:44 Lechance 阅读(281) 评论(0) 推荐(0)
摘要:##### ERROR stack traceorg.broadinstitute.sting.utils.exceptions.ReviewedStingException: An error occurred during the traversal.Message=GC overhead li... 阅读全文
posted @ 2015-02-04 14:43 Lechance 阅读(408) 评论(0) 推荐(0)
摘要:1:Application是什么? Application和Activity,Service一样,是android框架的一个系统组件,当android程序启动时系统会创建一个 application对象,用来存储系统的一些信息。通常我们是不需要指定一个Application的,这时系统会自动... 阅读全文
posted @ 2015-02-04 09:45 Lechance 阅读(1058) 评论(0) 推荐(0)
摘要:1. OnLowMemory() OnLowMemory()是Android提供的API,在系统内存不足,所有后台程序(优先级为background的进程,不是指后台运行的进程)都被杀死时,系统会调用OnLowMemory。系统提供的回调有:Application/Activity/Fragem... 阅读全文
posted @ 2015-02-04 09:33 Lechance 阅读(248) 评论(0) 推荐(0)
摘要:我们都知道,Android 2.3(姜饼) SDK发布的时候,在SDK中增加了第三方add-ons,其中就包括了针对平板电脑的Galaxy Tab Addon。当我们启动一个新的平板电脑模拟器的时候,首先我们需要设置“Scale display to real size"选项,这将让平板电脑的屏幕大... 阅读全文
posted @ 2015-02-03 16:03 Lechance 阅读(210) 评论(0) 推荐(0)