Time of Update: 2018-12-04
學習了一段時間的android,今天回頭看了看Android中的Socket編程,發覺其實Socket編程並不是很難,我把android中的Socket編程整理一下,給出我們一般Socket的步驟。一、Socket編程分伺服器端和用戶端,首先,必須建立一個伺服器端,以供用戶端來串連。以下是建立伺服器端程式的基本思路:1、首先建立一個ServerSocket對象,並讓這個ServerSocket在某一個連接埠號碼進行監聽;2、調用ServerSocket對象的accept()方法;3、從Socke
Time of Update: 2018-12-04
http://www.cnblogs.com/salam/archive/2010/11/30/1892143.html 我們在開發程式是經常會需要軟體全螢幕顯示、自訂標題(使用按鈕等控制項)和其他的需求,今天這一講就是如何控制Android應用程式的表單顯示. 首先介紹一個重要方法那就是requestWindowFeature(featrueId),它的功能是啟用表單的擴充特性。參數是Window類中定義的常量。一、枚舉常量1.DEFAULT_FEATURES:系統預設狀態,一般不需要指
Time of Update: 2018-12-04
除了能從一個Activity返回資料結果之外,向一個Activity傳遞資料也是很常用的。1. 建立一個工程,PassData。2. main.xml中的代碼。[java] view plaincopy<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="
Time of Update: 2018-12-04
除了使用自己手動寫的查詢URI,可以也使用Android內建的URI查詢常量。例如,除了使用content://contacts/people,可以寫這個指派陳述式。Uri allContacts =
Time of Update: 2018-12-04
ViewFlipper: Simple ViewAnimator that will animate between two or more views that have been added to it. Only one child is shown at a time. If requested, can automatically flip between each child at a regular interval.
Time of Update: 2018-12-04
In android, we can rotate the image using matrix post rotate.Example for Android Image Rotate
Time of Update: 2018-12-04
1.大量查詢資料庫時cursor沒有關閉錯誤寫法: Cursor cursor = getContentResolver().query( ); if(cursor != null){ cursor.moveTOFirst(); while(!cursor.isAfterLast()) { .............. }} 正確寫法:Cursor cursor = getContentResolver().query(
Time of Update: 2018-12-04
[功能] 1. ViewFlipper 可以包含多個View 且View之間的切換有Animation 比如:漸層效果 [代碼] 1. 建立包含ViewFlipper 的main.xml 還包含2個Button 用於各個View切換Java代碼 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
Time of Update: 2018-12-04
基於android官方doc,力圖以較為簡潔的方式說明android多螢幕適配的相關技術。螢幕尺寸(Screen size) 螢幕對角線的物理尺寸。android將所有螢幕尺寸分為四類:small、normal、large和extra large螢幕密度(Screen density) 單位(螢幕)物理地區中像素的數量,通常使用dpi(dots per inch),即每英吋像素數來表達。
Time of Update: 2018-12-04
《Android Dev
Time of Update: 2018-12-04
轉載 :http://student.csdn.net/space.php?uid=44933&do=blog&id=8104 由於目前基於Android的手機價格比較貴。如果只是為了體驗android,花幾千元買個手機也不值得。不過幸好Google想到了這一點,剛剛推出 了Android LiveCD 0.2。那麼什麼叫LiveCD呢?就是可以刻在光碟片中啟動的Android,可以在PC上運行。當然,也可以使用VMWare、VirtualPC等虛
Time of Update: 2018-12-04
Android中如何判斷系統當前是否處于飛行模式中:public static boolean IsAirModeOn(Context context) {return (Settings.System.getInt(context.getContentResolver(),Settings.System.AIRPLANE_MODE_ON, 0) == 1 ? true : false);}如何切換飛航模式public static void setAirplaneMode(Context
Time of Update: 2018-12-04
本人做了一個圖片瀏覽器,用了一些影像處理的演算法,這個是一部分,APK安裝包地址:http://static.apk.hiapk.com/html/2012/08/797656.html,歡迎下載和反饋;關於android系統映像特效處理之光照效果public static Bitmap sunshine(SoftReference<Bitmap> bmp) { final int width = bmp.get().getWidth();
Time of Update: 2018-12-04
1、ViewGroup類繼承與View,因此ViewGroup擁有View的一些特性,但是ViewGoup作為容器(LinearLayout,FrameLayout)的Base類,,也擁有一些View不具有的特性;2、ViiewGroup下面可以擁有多個子View,每個子View的大小和位置有ViewGoup調用View的Layout方法產生,而ViewGroup自身也擁有Layout方法背其Parent調用,再我們自己定義的ViewGroup中,OnLayout必須被實現,而OnMeasur
Time of Update: 2018-12-04
今天瀏覽鳳凰網科技頻道,看到頭條新聞“諾基亞前員工獲2億歐元融資 下月或推新MeeGo手機”,心中暗自高興,一款業內公認最完美的系統,不能這樣就死掉。 當今,IOS和Android的已經佔據智能手機市場80%的份額,Meego是否又可以奪回份額呢?這裡不得不對幾個系統進行一下比較,筆者有幸,這幾個系統都有較長時間的體驗,說出自己的看法,歡迎大家討論。 IOS: 無疑,現在消費者認為最好用的系統。
Time of Update: 2018-12-04
JAVA檔案:package com.control;import android.app.Activity;import android.os.Bundle;import android.widget.CheckBox;import android.widget.CompoundButton;import android.widget.Toast;public class MyActivity extends Activity { CheckBox mCheckBox; /**
Time of Update: 2018-12-04
1:cp Vendor_xxxx_Product_xxxx.idc frameworks/base/data/keyboards/ 2:vim common.mk 如後面添加上 Vendor_xxxx_Product_xxxx.idc檔案 然後從新make -j8; 3:突然想到一種在 Linux、Android 源碼裡面模仿添加檔案的方法:
Time of Update: 2018-12-04
android滑動手勢忘了從哪學的了,感謝原作者寫的很清楚代碼package com.sl.quwei.ui.manage;import android.app.Activity;import android.os.Bundle;import android.util.Log;import android.view.GestureDetector;import android.view.GestureDetector.OnGestureListener;import
Time of Update: 2018-12-04
package a.a;import android.app.Activity;import android.os.Bundle;import android.view.View;import android.widget.Button;import android.widget.EditText;public class AActivity extends Activity {/** Called when the activity is first created. */EditText
Time of Update: 2018-12-04
擷取流量資訊IBatteryStats battryStats = IBatteryStats.Stub.asInterface(ServiceManager.getService("batteryinfo")); byte[] data = null;try {data = battryStats.getStatistics();Parcel parcel = Parcel.obtain();parcel.unmarshall(data, 0,