Time of Update: 2013-12-11
init是一個進程,它是linux系統中使用者空間的第一個進程,其進程PID是1,父進程為linux系統核心的0號進程。所以其被賦予很多極其重要的職責,linux核心初始化完成後就開始執行它。代碼路徑:\system\core\init\init.c下面就分析一下先吧,只分析重點的函數功能:int main(int argc, char **argv){ // 1、設定子進程退出的訊號處理函數:sigchld_handler
Time of Update: 2013-12-11
typedef const struct JNINativeInterface *JNIEnv;const struct JNINativeInterface ... = { NULL, NULL, NULL, NULL, GetVersion, &
Time of Update: 2013-12-11
在Android中, 一個Activity可以理解為一個螢幕。 當程式要從一個Activity切換到另外一個Activity時,就需要用到Intent。Intent專門負責Android程式之間、以及程式內Activity與Service之間互動、通訊。 以下是一個簡單的demo,使用Intent從一個Activity切換到另一個Activity,並且傳遞一個資料進行顯示。 先看一下——
Time of Update: 2013-12-11
在介紹切換動畫效果前,先介紹下將使用到的Android
Time of Update: 2013-12-11
代碼:package angel.devil;import android.app.Activity;import android.app.Dialog;import android.os.Bundle;import android.view.Gravity;import android.view.Window;import android.view.WindowManager;public class DialogDemoActivity extends Activity
Time of Update: 2013-12-11
要記錄一組登入資訊,如 登入的伺服器,使用者名稱,密碼等資訊,使用喜好設定儲存和擷取會很便捷。列:[java]etUsername = (EditText)
Time of Update: 2013-12-11
【話不多說,直接上代碼】[java]package com.bison; import android.app.Activity; import android.os.Bundle; import android.text.Html; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import
Time of Update: 2013-12-11
在瀏覽器用戶端資料初始化資料最佳化時過程中,由於多次看到使用SharedPreferences儲存資料。於是查了下用戶端的SharedPreferencesManager的源碼,發現我們提交資料時的代碼形式如下: 1. public void putFloat(String key, float value)2. {3.
Time of Update: 2013-12-11
[java]採用xml寫出來的效果皆可以用代碼來實現,下面的代碼就是通過代碼編寫來實現view的狀態的轉場效果。 採用xml寫出來的效果皆可以用代碼來實現,下面的代碼就是通過代碼編寫來實現view的狀態的轉場效果。[java] public void setPressedBg(View view, Drawable normal,Drawable focused, Drawable
Time of Update: 2013-12-11
assets檔案夾裡面的檔案都是保持原始的檔案格式,需要用AssetManager以位元組流的形式讀取檔案。 1. 先在Activity裡面調用getAssets()來擷取AssetManager引用。 2. 再用AssetManager的open(String fileName, int
Time of Update: 2013-12-11
Activities提供了一種方便管理的建立、儲存、回複的對話方塊機制,例如 onCreateDialog(int), onPrepareDialog(int, Dialog), showDialog(int),
Time of Update: 2013-12-11
在為Android 增加多分區的支援時,可能會需要獲得當前 USB 串連的掛載口,可能標準的Android 架構並未提供這樣的介面給開發人員,這時就需要我們自己為它提供介面了。先來看一下上層(應用)如何得到一個IMountService 的。 private synchronized IMountService getMountService() { if (mMountService == null)
Time of Update: 2013-12-11
最近在做一個jWebSocket Android用戶端的Demo時遇到如下錯誤:"......The method onAccuracyChanged(Sensor, int) of type Fundamentals must override a superclass......""......The method onClick(View) of type new View.OnClickListener(){} must override a
Time of Update: 2013-12-11
編譯環境:Vmware workstation 7 + ubuntu 10.04 32位 1、安裝android sdk 2、32和64位均需要安裝的軟體包:git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev
Time of Update: 2013-12-11
static Comparator<File> comparator = new Comparator<File>() {public int compare(File f1, File f2) {if (f1 == null || f2 == null) {// 先比較nullif (f1 == null) {{return -1;}} else {return 1;}} else {if (f1.isDirectory() == true && f2.
Time of Update: 2013-12-11
文法(SYNTAX):<manifestxmlns:android="http://schemas.android.com/apk/res/android" package="string"
Time of Update: 2013-12-11
androidActivity之間的跳轉不只是有startActivity(Intent i)的,startActivityForResult(Intent intent, int requestCode)也是常用的方法。 其作用是可以用onActivityResult(int requestCode, int resultCode, Intent data)方法獲得請求Activity結束之後的操作。
Time of Update: 2013-12-11
package gongzibai.co.cc;import android.graphics.Matrix;import android.view.animation.AccelerateDecelerateInterpolator;import android.view.animation.Animation;import android.view.animation.Transformation;public class TV extends Animation
Time of Update: 2013-12-11
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo)當View對象相關的操作功能表顯示的時候,系統會調用該方法。跟onCreateOptionMenu(Menu,
Time of Update: 2013-12-11
---xml<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"