摘要: 集合在使用java的过程,会遇到各种各样的集合,所有的集合都实现了Collection接口list 中有 vector、ArrayList、LinkedList 。 set中HashSet,LinkedHashSet,SortedSet,TreeSetVector:基于Array的list,其实就是封装了Array所不具备的一些功能方便使用。Vector是同步(Synchronized)是线程安全的,arraylist的方法不是ArrayList:基于Array的链表,它不是同步的,在性能上臂Vector优越,LinkedList:不是基于Array的,每一个节点都包含两方便的内容:1.节点本 阅读全文
posted @ 2013-03-15 01:02 小三小山 阅读(132) 评论(0) 推荐(0) 编辑
摘要: android中的数据库只有唯一的SQLite,这样便于操作,该数据库是android自带的数据库,用户无需向j2ee那样,没做一个东西要添加一个jar文件,多么的麻烦。一、数据库的创建package com.will.db;import android.content.Context;import android.database.sqlite.SQLiteDatabase;import android.database.sqlite.SQLiteOpenHelper;public class DBConn extends SQLiteOpenHelper{ public DBConn... 阅读全文
posted @ 2013-03-15 00:36 小三小山 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 单选跟多选的差别在于其中一个元素的不同而已,先看以下的代码:xml<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="verti 阅读全文
posted @ 2013-03-15 00:24 小三小山 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 通过ListView实现组件单选,并能够对其中的值进行读取的操作。以下是具体的代码: main xml代码:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:or 阅读全文
posted @ 2013-03-15 00:20 小三小山 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 通过java代码中定义Toast函数可以达到跟在xml文件中定义一样的效果,具体实现如下:package com.will.test;import android.app.Activity;import android.os.Bundle;import android.widget.ImageView;import android.widget.LinearLayout;import android.widget.Toast;public class MainActivity extends Activity{ @Override protected void onCreate(B... 阅读全文
posted @ 2013-03-15 00:16 小三小山 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 通过直接继承listActivity可以达到listview的效果xml无须做什么修改,只要在Activity文件中修改就可以以下是java代码:package com.example.listactivity;import android.app.ListActivity;import android.os.Bundle;import android.view.View;import android.view.ViewGroup;import android.widget.ArrayAdapter;import android.widget.BaseAdapter;import androi 阅读全文
posted @ 2013-03-15 00:12 小三小山 阅读(136) 评论(0) 推荐(0) 编辑