随笔分类 -  android

摘要:作为一个android新手,在绑定数据的时候是这样的 ListView listview=(ListView)this.findViewById(R.id.listView1); XJDal xj=new XJDal(MainActivity.this); Cursor cur=xj.Query(); ListAdapter ad=new... 阅读全文
posted @ 2013-06-21 11:54 张巍的博客 阅读(2296) 评论(0) 推荐(0)
摘要:Android中,Activity是所有程序的根本,所有程序的流程都运行在Activity之中,Activity具有自己的生命周期,由系统控制生命周期,程序无法改变,但可以用onSaveInstanceState保存其状态)。对于Activity,关键是其生命周期的把握(如下图),其次就是状态的保存和恢复(onSaveInstanceState onRestoreInstanceState),以及Activity之间的跳转和数据传输(intent)。Activity中常用的函数有SetContentView() findViewById() finish() startActivity(),其 阅读全文
posted @ 2011-06-07 22:43 张巍的博客 阅读(437) 评论(0) 推荐(0)
摘要:android的数据存储方式有1.SharedPreferences 2.文件存储3.SQLite存储4.内容提供器(Content provider)5.网络1.SharedPreferences是android用来提供用来存储简单的配置信息的一种方式。是一种key/value关系的数据类型,数据保存在一个xml文件中首先需要创建一个SharedPreferences对象 SharedPreferences s=getSharedPreferences("filename", 0);其中 第一个参数为保存的文件名,在FileExplorer中/data/data/包名/s 阅读全文
posted @ 2011-06-02 13:46 张巍的博客 阅读(357) 评论(0) 推荐(0)
摘要:在使用布局前我们需要了解两个属性:竖直方向布局:android:layout_height="wrap_content"水平方向布局:android:layout_width="match_parent"wrap_content表示包裹内容而不填充,match_parent表示铺满父容器,fill_parent和match _parent的意思一样 ,在2.2以上两个词都可以用,2.2以下的话,用fill_parent。使用FrameLayout布局FrameLayout对象就好比在一块屏幕上提前一定好的空白区域,然后可以填充元素在里面。所有元素被放置在 阅读全文
posted @ 2011-05-31 11:14 张巍的博客 阅读(2701) 评论(0) 推荐(1)