原创 Intent來傳遞對象

使用Intent來傳遞對象通常有兩種方式,Serializable和Parcelable 一、Serializable方式 序列化,表示將一個對象轉換成可存儲或可傳輸的狀態。序列化後的對象可以在網絡上進行傳輸,也可以存儲到本地。序列化的方

原创 通知(Notification)初探

通知用法:1.在活動裏創建;2.在廣播接收器裏創建;3.在服務裏創建 步驟: 1.通過NotificationManager來對通知進行管理,調用Context的getSystemService()方法獲取到(參數爲Context.NO

原创 ListView_BaseAdapter

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"

原创 定製LogCat

public class LogUtil { public static final int VERBOSE = 1; public static final int DEBUG = 2; public static fi

原创 電話撥號器

調用調用撥號器 一、邏輯代碼 //我們需要告訴系統,我們的動作:我要打電話 //創建意圖對象 Intent intent = new Intent(); //把動作封裝至意圖對象當中 intent.setAc

原创 pull解析

//獲取到src文件夾下的資源文件 InputStream is = getClassLoader().getResourceAsStream("weather.xml"); //拿到pull解析器對象 XmlPul

原创 對話框

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/to

原创 在SD卡讀寫

//MEDIA_UNKNOWN:不能識別sd卡 //MEDIA_REMOVED:沒有sd卡 //MEDIA_UNMOUNTED:sd卡存在但是沒有掛載 //MEDIA_CHECKING:sd

原创 圖片下載之緩存

public class MainActivity extends Activity { static ImageView iv; static MainActivity ma; static Handler handler =

原创 Android調用攝像頭和相冊

一、UI界面 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent"

原创 文件讀取權限

文件訪問權限 指的是誰能訪問這個文件 在Android中,每一個應用,都是一個獨立的用戶 使用10個字母表示 drwxrwxrwx 第一個字母: d:表示文件夾 -:表示文件  第一組rwx:表示的是文件擁有者(owner)對文件的權限

原创 Xml序列化器

//使用xml序列化器生成xml文件 //1.拿到序列化器對象 XmlSerializer xs = Xml.newSerializer(); //2.初始化 File file = new File("sdcard/

原创 在內部存儲中讀寫文件

一、寫文件 <span style="white-space:pre"> </span>//data/data/com.xxx:這就是內部存儲空間的路徑 File file = new File("data/data/co

原创 SQLite使用

public class MyOpenHelper extends SQLiteOpenHelper { public MyOpenHelper(Context context, String name, CursorFactory

原创 JSON解析

一、Android自帶JSON解析的API 1.讀取JSON格式數據 { "languages":[ {"id":1,"ide":"Eclipse","name":"Java"}, {"id":2,"ide":"XCode","