LruCache为什么需要保存到RetainFragment, why need RetainFragment?

看了android 文档里的bitmapfun例子, 一开始怎么都不明白为什么需要把LruCache放到fragment里面, 后来再仔细回头看了看文档:

Runtime configuration changes, such as a screen orientation change, cause Android to destroy and restart the running activity with the new configuration (For more information about this behavior, see Handling Runtime Changes). You want to avoid having to process all your images again so the user has a smooth and fast experience when a configuration change occurs.

Luckily, you have a nice memory cache of bitmaps that you built in the Use a Memory Cache section. This cache can be passed through to the new activity instance using a Fragment which is preserved by callingsetRetainInstance(true)). After the activity has been recreated, this retained Fragment is reattached and you gain access to the existing cache object, allowing images to be quickly fetched and re-populated into theImageView objects.


原来当手机横竖屏变化时, activity会被销毁再创建,为了不丢失LruCache, 所以通过setRetainInstance(true), 保存了cache里的数据, 我就更疑惑了, 为什么不把LruCache设置成全局静态变量, 这样不是程序所有地方都可以共享地用到cache了吗

dedecms 不支持 php 5.4.6

dedecms 使用了php方法session_register, 而在php 5.4.X里已经把这个方法去掉了, 所以为了使用dedecms目前最高版本只能用到5.3.X, 我目前用的dedecms版本是V5.7正式版(2012-06-21).

windows browser not using hosts file – but ping is ok

if you are using proxy to connect the network, the hosts file may not work for browser,
but the ping is ok, ping will return the correct ip address you set in hosts file,i haven’t found a solution to make it working, since if not set the proxy, network will totally not work.

hosts文件为什么对浏览器没用呢,而ping返回来的又是正确的IP呢? 有可能是你正在使用代理上网,
目前我也不知道怎么解决这个问题, 因为不设代理的话,网络就完全不能用了

css width height not working

sometimes you may find that css width height does not working for html tag b, span,div

i came across it also

i set the position: absolute, then it do work well

below is my css, you can test

    left: 25px;
    position: absolute;
    top: 20px;
    background-image: url("./Resources/loading.gif");
    overflow: hidden;
    height: 40px;
    width: 40px;
    background-repeat: no-repeat;