Time of Update: 2013-12-10
一、如何顯示assets/license.txt(中文)的內容?(1)方法1:InputStream.available()得到位元組數,然後一次讀取完。private String readUserAgreementFromAsset(String assetName) { String content
Time of Update: 2013-12-10
今天看到有一個人寫的代碼,有幾個奇怪的方法。如下:public boolean onKeyDown(int keyCode, KeyEvent event) { // TODO Auto-generated method stub if (keyCode == KeyEvent.KEYCODE_BACK)
Time of Update: 2013-12-10
在應用的圖集中,通常會給使用者提供儲存圖片的功能,讓使用者可以將自己喜歡的圖片儲存到系統相簿中.這個功能其實很好做,系統提供了現成的API:簡單的來說就這一行代碼: [java] MediaStore.Images.Media.insertImage(getContentResolver(), mBitmap, "",
Time of Update: 2013-12-10
Android系統提供了很多服務管理的類,包括ActivityManager、PowerManager(電源管理)、AudioManager(音頻管理)以及PackageManager管理類。PackageManager管理應用程式包。 它可以擷取應用程式各種資訊。 PackageManger 類 說明: 獲得已安裝的應用程式資訊 。可以通過getPackageManager()方法獲得。
Time of Update: 2013-12-10
我們在Android學習中,經常會匯入工程源碼進行學習,但是有的工程源碼匯入後會出現一個大大的紅色驚嘆號,然後出現The project was not built since its build path is incomplete. Cannot find the class file for
Time of Update: 2013-12-10
點擊每個按鈕都會有對應的動畫顯示 activity代碼:package com.tmacsky;import android.app.Activity;import android.os.Bundle;import android.util.Log;import android.view.View;import android.view.View.OnClickListener;import android.view.animation.AlphaAnimation;import
Time of Update: 2013-12-10
系統內建的Theme:--------------------------------------------------------------------------------android以及為我們定義好了一些theme,需要是我們直接可以拿來使用。常用的Theme通常如下: android:theme="@android:style/Theme.Dialog"將一個activity顯示為對話方塊模式 android:theme=&qu
Time of Update: 2013-12-10
效果 點擊Home鍵的時候,會彈出選擇2個luncher中的哪一個~LuncherTest是我們自訂的在啟動的activity中<intent-filter>中間加入三行代碼就ok了,關於LuncherTest的具體內容就可以自己來設定,這裡就不詳述了~ intent-filter> <action
Time of Update: 2013-12-10
1.sharedpreference,儲存簡單的資訊,比如使用者名稱,密碼package com.google.datastore.sharep;import android.app.Activity;import android.content.Context;import android.content.SharedPreferences;import android.os.Bundle;import android.view.View;import
Time of Update: 2013-12-10
1.使G-sensor正常工作需要做的事:G-sensor driver檔案包括:driver/i2c/chips/lis331dl.cdriver/i2c/chips/sensorioctl.hinclude/linux/lis331dl.h並在/kernel/arch/arm/mach-s3c6410/mach-ur6410.c檔案中i2c chanel1的結構變數i2c_devs1[]
Time of Update: 2013-12-10
android2.3提供的json解析類 android的json解析部分都在包org.json下,主要有以下幾個類: JSONObject:可以看作是一個json對象,這是系統中有關JSON定義的基本單元,其包含一對兒(Key/Value)數值。它對外部(External: 應用toString()方法輸出的數值)調用的響應體現為一個標準的字串(例如:{"JSON": "Hello, World"
Time of Update: 2013-12-10
在CallNotifier.java中 加入如下代碼: public void GetSensorManager(Context context) { sm = (SensorManager) context .getSystemService(Service.SENSOR_SERVICE); sensor = sm.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
Time of Update: 2013-12-10
Bitmap bit=Reflect3DImage.skewImage(bit, 50);package com.maxway.util; import android.graphics.Bitmap; import android.graphics.Bitmap.Config; import android.graphics.Camera; import android.graphics.Canvas; import
Time of Update: 2013-12-10
在styles裡面加<style name="transparent2" parent="@android:style/Theme.Translucent"> <item name="android:windowNoTitle">true</item> </style>然後在activity裡面加theme屬性<
Time of Update: 2013-12-10
Android中有許多隱藏的Service,StatusBarManager就是其中一個,在Context.java中可以看到:[java]/** * Use with {@link #getSystemService} to retrieve a {@link * android.app.StatusBarManager} for interacting with the status bar. * * @see
Time of Update: 2013-12-10
以下方法為網上找到的方法:一、 如何刪除項目的緩衝:getCacheDir()能夠得到當前項目的緩衝地址在項目中經常會使用到WebView 控制項,當載入html 頁面時,會在/data/data/應用package 目錄下產生database與cache 兩個檔案夾。請求的url 記錄是儲存在WebViewCache.db,而url 的內容是儲存在WebViewCache
Time of Update: 2013-12-10
package cn.testservice1;import android.os.Bundle;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;import android.app.Activity;import android.content.Intent;/** * Demo描述: * 採用startService()方法啟動服務 *
Time of Update: 2013-12-10
作為一個完成的應用程式,資料存放區操作是必不可少的。因此,Android系統一共提供了四種資料存放區方式。分別是:SharePreference、SQLite、Content Provider和File。由於Android系統中,資料基本都是私人的的,都是存放於“data/data/程式包名”目錄下,所以要實現資料共用,正確方式是使用Content Provider。 SQLite: SQLite是一個輕量級的資料庫,支援基本SQL文法,是常被採用的一種資料存放區方式。
Time of Update: 2013-12-10
<!-- android:shadowDx 陰影的水平位移量 即往右移的距離 --> <!-- android:shadowDy 陰影的垂直位移量 即往下移的距離--> <!-- android:shadowColor 陰影顏色 --> <!-- android:shadowRadius 陰影的範圍 即陰影透明和擴散的程度--> <style name="textViewStyle">
Time of Update: 2013-12-10
源碼運行請見文章最後。本文主要介紹Android中的5種資料存放區方式。 資料存放區在開發中是使用最頻繁的,在這裡主要介紹Android平台中實現資料存放區的5種方式,分別是: 1