Time of Update: 2013-12-11
首先看一下java下的多線程的幾個關鍵方法 01 Object obj = new Object() ; 02 while(!condition) { 03 obj.wait(); 04 } 05 obj.doSomething(); 06 } 07 08 09 10
Time of Update: 2013-12-11
今天研究了下android回調,下面給出一個相當容易的一個小例子,該例子的作用是五秒回調一次,每次會輸出一個字串,代碼很簡單,相信大家看得懂,感覺這個回調和iPhone的協議差不多,見代碼:[cpp] package com.hlj.huidiao; public class HuidiaoUtil { public void huidiao(final huidiaoCallback
Time of Update: 2013-12-11
自訂捲軸樣子:在ListView中添加屬性:android:scrollbarTrackVertical="@drawable/scrollbar_vertical_track"android:scrollbarThumbVertical="@drawable/scrollbar_vertical_thumb"scrollbar_vertical_track,crollbar_vertical_thumb自訂的xml檔案,放在Drawable中,track
Time of Update: 2013-12-11
App->Activity->Custom Dialog 例子使用Activity 來實現自訂對話方塊。 類CustomDialogActivity本身無任何特別之處。關鍵的一點是其在AndroidManifest.xml中的定義:<activity
Time of Update: 2013-12-11
這裡我們使用類比的方法,將 PreferenceActivity 與一般的Activity 作個類比,可以更好的理解Android.Preference中的各個類。PreferenceActivity ActivityPreference ViewPreferenceGroup ViewGroupPreferenceScreen LinearLayoutCheckBoxPreference CheckBoxEditTextPreference EditTextListPreference
Time of Update: 2013-12-11
這個一般是因為設定檔中的JDK版本不對導致的 設定檔就是 工程目錄下.settings檔案夾中org.eclipse.jdt.core.prefs檔案我們如果用UEdit或記事本開啟他可以看到裡面的代碼是這樣的01#Wed Mar 21 16:05:12 CST 201202eclipse.preferences.version=1
Time of Update: 2013-12-11
調用WindowManager,並設定WindowManager.LayoutParams的相關屬性,通過WindowManager的addView方法建立View,這樣產生出來的View根據WindowManager.LayoutParams屬性不同,效果也就不同了。比如建立系統最上層視窗,實現懸浮視窗效果!WindowManager的方法很簡單,基本用到的就三個addView,removeView,updateViewLayout。而WindowManager.LayoutParams的屬性
Time of Update: 2013-12-11
Remote Service Controller 和使用Local Service的Android ApiDemo樣本解析(40):App->Service->Local Service Controller都是使用Service的“Started” 模式,RemoteService在 AndroidManifest.xml中的定義如下:<service android:name=”.app.RemoteService”
Time of Update: 2013-12-11
----------------------.xml<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
Time of Update: 2013-12-11
一、簡訊分享01Intent intent = new Intent(Intent.ACTION_SEND);02// intent.setType("text/plain"); //純文字03// 圖片分享04intent.setType("image/png");05// 添加圖片06File f = new File("/sdcard/sd.png");07Uri u =
Time of Update: 2013-12-11
伺服器端代碼[java] package org.xiazdong.servlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import
Time of Update: 2013-12-11
BitmapDecode 例子主要介紹了Android 平台對映像的解碼功能,Android平台支援PNG, JPEG映像格式,並可以支援 gif動畫。Android API中用來解碼映像的類主要有BitmapFactory (靜態映像PNG或是JPEG)和Movie 解碼動畫(gif動畫等)。對映像或動畫解碼,資料來源可以說byte 數組,InputStream ,資源ID,或者指定檔案名稱。對於BitmapFactory來說,還可以通過BitmapFactory.Options
Time of Update: 2013-12-11
下載新的RoboGuice庫,Roboguice2.0 庫有四個庫組成,如所示:2. 建立一個新Android項目,比如GuiceDemo,目標平台Android1.5以上。3. 一般可以在該項目下添加一個libs目錄,將兩個jar檔案拷到libs目錄下,然後通過: Project > Properties > Java Build Path > Libraries > Add JARs 註:從ADT17開始,添加的jar檔案需放在libs
Time of Update: 2013-12-11
[代碼] 調用撥號程式 1 // 給移動客服10086撥打到電話 2 Uri uri = Uri.parse("tel:10086"); 3 Intent intent = new Intent(Intent.ACTION_DIAL, uri); 4 startActivity(intent);[代碼] 傳送簡訊或多媒體訊息 01 // 給10086發送內容為“Hello”的簡訊 02
Time of Update: 2013-12-11
[java] /* * 取得手機電池的剩餘量 * Android API中的BroadcastReceiver(Android.content.BroadcastReceiver) * 類有點像Button中的Listener,當Receiver被註冊後,會在後台等待其他程式 * 的調用,程式將通過註冊BroadcastReceiver時設定的IntentFilter來捕捉系統 *
Time of Update: 2013-12-11
CornerPathEffect 修改路徑上線段串連處的顯示模式(從尖角改為可以指定圓弧半徑的圓角聯結)。DashPathEffect 虛線顯示效果,使用數組來指定需線和間隔的長度。數組中序數為偶數表示虛線的實線長度,奇數為虛線的間隔長度。 只對Paint設為STROKE 或STROKE_AND_FILL時有效。PathDashPathEffect
Time of Update: 2013-12-11
Patterns指可以使用位元影像(材質)來填充某個圖形。本例使用兩個位元影像來填充螢幕:一是外藍裡紅的矩形[java] private static Bitmap makeBitmap1() { Bitmap bm = Bitmap.createBitmap(40, 40, Bitmap.Config.RGB_565); Canvas c = new
Time of Update: 2013-12-11
從功能上看android.graphics.Picture 和 android.graphics.Bitmap 非常像。 Picture可以記錄在Canvas上每個繪製操作(通過beginRecording返回的Canvas),然後回放每個繪圖操作。同時也支援將Picture中的內容寫到Stream中,並支援從Stream恢複Picture。這些功能使用Bitmap也能實現。但Picture
Time of Update: 2013-12-11
Linux Kernel for Android 4.0--- 初稿 2011-11-251. android 4.0 system be released2011-10-19上午10點,google發布了代號為Ice Cream Sandwich(簡稱ICS,冰淇淋三明治)的android4.0系統。十大特性:…4)、 同步升級Linux核心 更新3.0以上版本…2. linux kernel
Time of Update: 2013-12-11
*/眾所周知,資料庫是很重要的。市面上的大大小小的軟體差不多都要用到資料庫。在Android中資料庫為SQlite,因為小巧便捷,佔用的空間少,易於操作。使用很受歡迎。資料庫不外乎查詢(query)新增(insert)修改(update)刪除(delete)。本例子1.使用Menu按鍵來做資料庫的查詢(query)新增(insert)修改(update)刪除(delete)。2.搭配ListView