Savage F. Morgan

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
上一页 1 ··· 4 5 6 7 8

2013年1月29日

摘要: Do all the Activities and Services of an application run in a single process?All Activities and Services in an application run in a single process by default. If needed, you can declare an android:process attribute in your manifest file, to explicitly place a component (Activity/Service) in another 阅读全文
posted @ 2013-01-29 16:40 罗斯摩根 阅读(468) 评论(0) 推荐(0) 编辑

2013年1月25日

摘要: public static Object copy(Object oldObj) { Object obj = null; try { // Write the object out to a byte array ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(bos); out.writeObject(oldObj); o... 阅读全文
posted @ 2013-01-25 08:17 罗斯摩根 阅读(187) 评论(0) 推荐(0) 编辑

2013年1月24日

摘要: 曾经遇到过一个面试题,让你写出横屏切换竖屏Activity的生命周期。现在给大家分析一下他切换时具体的生命周期是怎么样的:1、新建一个Activity,并把各个生命周期打印出来2、运行Activity,得到如下信息onCreate-->onStart-->onResume-->3、按crtl+f12切换成横屏时onSaveInstanceState-->onPause-->onStop-->onDestroy-->onCreate-->onStart-->onRestoreInstanceState-->onResume-->4 阅读全文
posted @ 2013-01-24 19:59 罗斯摩根 阅读(362) 评论(1) 推荐(0) 编辑

摘要: 再次感叹Android的碎片化!!!!设置AndroidManifest.xml中Activity的android:configChanges=”keyboardHidden|orientation|screenSize”Android4.0需设置screenSize才有效果.2.2,2.3这些只需设置keyboardHidden|orientation4.0 --> keyboardHidden|orientation|screenSize<activity android:name=".MainActivity" android:configCh... 阅读全文
posted @ 2013-01-24 19:56 罗斯摩根 阅读(6868) 评论(1) 推荐(0) 编辑

2013年1月23日

摘要: Avoid Creating Unnecessary ObjectsObject creation is never free. A generational garbage collector with per-thread allocation pools for temporary objects can make allocation cheaper, but allocating memory is always more expensive than not allocating memory.As you allocate more objects in your app, yo 阅读全文
posted @ 2013-01-23 06:59 罗斯摩根 阅读(508) 评论(0) 推荐(0) 编辑

摘要: 首先解释下这句话This Handler class should be static or leaks might occur,大致意思就是说:Handler类应该定义成静态类,否则可能导致内存泄露。具体如何解决,在国外有人提出,如下:Issue: Ensures that Handler classes do not hold on to a reference to an outer classIn Android, Handler classes should be static or leaks might occur. Messages enqueued on the applic 阅读全文
posted @ 2013-01-23 00:19 罗斯摩根 阅读(14539) 评论(2) 推荐(0) 编辑

2013年1月9日

摘要: 最近用到了,所以依然是转载ArrayList 和Vector是采用数组方式存储数据,此数组元素数大于实际存储的数据以便增加和插入元素,都允许直接序号索引元素,但是插入数据要设计到数组元素移动等内存操作,所以索引数据快插入数据慢,Vector由于使用了synchronized方法(线程安全)所以性能上比ArrayList要差,LinkedList使用双向链表实现存储,按序号索引数据需要进行向前或向后遍历,但是插入数据时只需要记录本项的前后项即可,所以插入数度较快!线性表,链表,哈希表是常用的数据结构,在进行Java开发时,JDK已经为我们提供了一系列相应的类来实现基本的数据结构。这些类均在jav 阅读全文
posted @ 2013-01-09 15:49 罗斯摩根 阅读(228) 评论(0) 推荐(0) 编辑

2012年12月22日

摘要: package studio.sm.homework;import java.awt.BorderLayout;import java.awt.Container;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.io.BufferedInputStream;import java.io.BufferedOutputStream;import java.io.DataInputStream;import java.io.DataOutputStream;import java.i 阅读全文
posted @ 2012-12-22 19:46 罗斯摩根 阅读(230) 评论(0) 推荐(0) 编辑

上一页 1 ··· 4 5 6 7 8