Time of Update: 2018-12-06
1. Parcelable介面Interface for classes whose instances can be written to and restored from a Parcel。 Classes implementing the Parcelable interface must also have a static field called CREATOR, which is an object implementing the Parcelable.Creator
Time of Update: 2018-12-06
Android項目開發完成以後就得將android專案檔打包成apk檔案,放到市場上去,以便於讓別人也來分享你的應用啊!接下來介紹一下個人打包apk的過程。1、產生keystore檔案在命令列中,輸入以下命令:keytool -genkey -alias android.keystore -keyalg RSA -validity 100000 -keystore
Time of Update: 2018-12-06
今天遇到一個很詭異的問題,之前編寫的正確無誤的Android工程,在這次開啟Eclipse之後,工程上居然有個大紅色的叉:仔細查看各程式,沒有任何錯誤,只有個別警告。開啟Window-Show View-Problems,如所示:會看到錯誤原因:Error generating final archive: Debug certificate expired on xxxxxx(日期)這是因為認證到期了。解決方案:C:/Documents and Settings/USER.android
Time of Update: 2018-12-06
應用情境:實現判斷當前網路是否可用當前有可用網路,如:當前沒有可用網路,如:實現步驟:1、擷取ConnectivityManager對象Context context = activity.getApplicationContext();// 擷取手機所有串連管理對象(包括對wi-fi,net等串連的管理)ConnectivityManager connectivityManager = (ConnectivityManager)context.getSystemService(Context.
Time of Update: 2018-12-06
今天在網上下了個源碼,匯入的時候發現出現Invalid project description的提示,翻譯成中文就是“無效的項目描述”的意思,搞不明白遂百度找到瞭解決辦法,現記錄並共用之!Android匯入一個工程時提示 Invalid project description字樣,當我們單擊<Details>按鈕查看詳細內容可以看到overlaps the location of another
Time of Update: 2018-12-06
常用:1、px (pixels)像素:一般HVGA 代表320x480 像素,這個用的比較多。2、dip 或dp (device independent pixels)裝置獨立像素:這個和裝置硬體有關,一般為了支援WVGA、HVGA 和QVGA 推薦使用這個,不依賴像素。3、sp (scaled pixels — best for text size)比例像素:主要處理字型的大小,可以根據系統的字型自適應。不太常用:1、in (inches)英寸2、mm (millimeters)毫米3、pt
Time of Update: 2018-12-06
1.SharedPreferences簡介為了儲存軟體的設定參數,Android 平台為我們提供了一個SharedPreferences 類,它是一個輕量級的儲存類,特別適合用於儲存軟體配置參數。使用SharedPreferences 儲存資料,其背後是用xml檔案存放資料,檔案存放在/data/data/<package name>/shared_prefs 目錄下。2.擷取SharedPreferences對象方法:SharedPreferences pre = Context.
Time of Update: 2018-12-06
1.drawable-(hdpi,mdpi,ldpi)的區別 dpi是“dot per inch”的縮寫,每英吋像素數。 四種密度分類: ldpi (low), mdpi (medium), hdpi (high), and xhdpi (extra high) 一般情況下的普通螢幕:ldpi是120,mdpi是160,hdpi是240,xhdpi是320。2.WVGA,HVGA,QVGA的區別 VGA是“Video Graphics Array”,顯示標準為640*480。
Time of Update: 2018-12-06
Application類Application和Activity,Service一樣是Android架構的一個系統組件,當Android程式啟動時系統會建立一個Application對象,用來儲存系統的一些資訊。Android系統自動會為每個程式運行時建立一個Application類的對象且只建立一個,所以Application可以說是單例(singleton)模式的一個類。通常我們是不需要指定一個Application的,系統會自動幫我們建立,如果需要建立自己的Application,那也很簡
Time of Update: 2018-12-06
所謂無圖無真相,先看: Java代碼如下: package yc.android.fonts;import android.app.Activity;import android.graphics.Typeface;import android.os.Bundle;import android.widget.TextView;public class Y_fonts extends Activity {/** Called when the activity is first
Time of Update: 2018-12-06
先看: 其實就是 DisplayMetrics類 的應用 ,代碼如下:package yc.android.resolution;import android.app.Activity;import android.os.Bundle;import android.util.DisplayMetrics;import android.view.View;import android.widget.Button;import android.widget.TextView;public
Time of Update: 2018-12-06
一、什麼是XMPP?Extensible Messaging and Presence Protocol,簡單的來講,它就是一個發送接收處理訊息的協議,但是這個協議發送的訊息,既不是二進位的東東也不是字串,而是XML。二、什麼是IM?Instant Messenger,及時通訊軟體,就是大家使用的QQ、MSN Messenger和Gtalk等等。其中Gtalk 就是基於XMPP 協議的一個實現,其他的則不是。當前IM
Time of Update: 2018-12-06
最基本分享方法:Intent intent = new Intent(Intent.ACTION_SEND); // 啟動分享發送的屬性intent.setType("text/plain"); // 分享發送的資料類型intent.setPackage(packAgeName);intent.putExtra(Intent.EXTRA_SUBJECT, "xx分享"); // 分享的主題intent.putExtra(Intent.EXTRA_TEXT, "分享內容"); // 分享的內容mA
Time of Update: 2018-12-06
對於我國的山寨產品,大家總是抱著懷疑的態度。然而眾多的山寨廠商在這種目光之下卻越來越希望用實際來證明自己的實力。近日,深圳ODM廠商太和時代發布了一款號稱全球首款的Tegra2+Android4.0的平板(現在僅有華碩的Transformer Prime“號稱”將內建Android 4.0,但它依然未發售),讓眾多一線品牌尷尬無比。該款平板搭載Tegra2處理器,系統內建Android
Time of Update: 2018-12-06
AIDL即android
Time of Update: 2018-12-06
剛開始搭建開發環境的時候,有幾個容易出問題的地方,記下來以備參考。 必須的程式: Eclipse,java的IDE,:http://www.eclipse.org/downloads/ JDK,:http://www.oracle.com/technetwork/java/javase/downloads/index.html其他很多資料上給的都是Sun的,因為Oracle已經把Sun收購了,因此現在地址已經都換了。 Android
Time of Update: 2018-12-06
新版本在智能提示的時候經常卡死,找了很多辦法,但很多也不管用。今天終於解決了: http://www.cnblogs.com/zenghanxi/archive/2010/08/13/1799229.html 新下了eclipse3.6,很開心,多了一些新功能。好景不長,沒用多久就卡起來了,又下了個最瘦的那個版本都卡,找了好久,關了很多東西都沒有用,終於發現原來是 "Usage Data Collector"
Time of Update: 2018-12-06
// 建立一個toast對象private Toast toast; public void showMsg(String arg) { if (toast == null) { toast = Toast.makeText(this, arg, Toast.LENGTH_SHORT); } else { toast.cancel(); toast.setText(arg); }
Time of Update: 2018-12-06
詳情參考 某android平板項目開發筆記---計劃任務備份建立一個類繼承 AsyncTaskpublic class BackupTask extends AsyncTask<String, Void, Integer> { private static final String COMMAND_BACKUP = "backupDatabase"; public static final String COMMAND_RESTORE =
Time of Update: 2018-12-06
參考 Android拍照、錄影、錄音代碼範例 public class MyCameraActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);