Time of Update: 2018-12-05
Android中如何修改系統時間(應用程式獲得系統許可權) 在 android 的API中有提供 SystemClock.setCurrentTimeMillis()函數來修改系統時間,可惜無論你怎麼調用這個函數都是沒用的,無論模擬器還是真機,在logcat中總會得到"Unable to open alarm driver: Permission denied
Time of Update: 2018-12-05
/*** 得到位置資訊*/private void getLocation() {// 擷取位置管理服務LocationManager locationManager;String serviceName = Context.LOCATION_SERVICE;locationManager = (LocationManager) this.getSystemService(serviceName);// 尋找到服務資訊Criteria criteria = new
Time of Update: 2018-12-05
一、重要包的描述:android.app :提供高層的程式模型、提供基本的運行環境android.content :包含各種的對裝置上的資料進行訪問和發布的類android.database :通過內容提供者瀏覽和操作資料庫android.graphics :底層的圖形庫,包含畫布,顏色過濾,點,矩形,可以將他們直接繪製到螢幕上.android.location :定位和相關服務的類android.media :提供一些類管理多種音頻、視頻的媒體介面android.net
Time of Update: 2018-12-05
class RecordThread extends Thread { private AudioRecord ar; private int bs; private final int SAMPLE_RATE_IN_HZ = 8000; private boolean isRun = false; public RecordThread() {
Time of Update: 2018-12-05
遊戲開發中,通過資料和書籍瞭解到在有兩種播放音頻形式可以用在我們的遊戲開發中,第一個:MediaPlayer 類 ;第二個:SoundPool 類!PS:當然還有一個JetPlayer 但是 播放的檔案格式比較麻煩,所以這裡拋開不解釋,有興趣的可以去自己研究下、呵呵;運行:MediaPlayer 和:SoundPool
Time of Update: 2018-12-05
這裡說的清除是在軟體中清理其它程式的緩衝,有兩種。均用到反射這方面的知識,沒辦法,Android系統API把這些方法隱藏了。反射就不說了,不懂得可以自己百度,Google! 一種帶root許可權的:Class c1 = Class.forName("android.content.pm.IPackageDataObserver");Method method = pm.getClass().getMethod("deleteApplicationCacheFiles",
Time of Update: 2018-12-05
/* * Copyright (C) 2011 The Rexsee Open Source Project * * Licensed under the Rexsee License, Version 1.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * *
Time of Update: 2018-12-05
android編譯找不到資源id的問題一般情況下找不到id有以下幾個原因:1、id不匹配2、xml未編譯3、編譯順序有問題4、未import正確的資源套件在frameworks/base/core/res/res下編譯產生的資源檔儲存在out/target/common/R/com/android/internal/R.java所以先在R.java內看有沒有你的id,然後檢查原始碼有沒有:import
Time of Update: 2018-12-05
許可權: <uses-permissionandroid:name="android.permission.FLASHLIGHT" /> <uses-permissionandroid:name="android.permission.WAKE_LOCK" /> <uses-permission
Time of Update: 2018-12-05
最近工作要實現換壁紙小功能,將代碼做成demo發出來沒有採用zip格式換膚,因為只是更換一張圖片背景1.將三張圖放入drawable-hdpi,我放的是480*800的2.用sharedPreference存取皮膚的id,以便於下次啟動的時候根據id來選擇用哪個皮膚,在onresume()裡重新整理皮膚3.存到sharedPreference的資料採用string,不能採用圖片的id,因為圖片的id是每次程式啟動後又會重建的不多說了直接上,代碼public class
Time of Update: 2018-12-05
Time of Update: 2018-12-05
android 1.5以後添加了軟體虛擬鍵盤的功能,所以在輸入提示中將會有對應的軟鍵盤模式android中inputType屬性在EditText輸入值時啟動的虛擬鍵盤的風格有著重要的作用。這也大大的方便的操作。有時需要虛擬鍵盤只為字元或只為數字。所以inputType尤為重要。<EditText android:layout_width="fill_parent" android:layout_height="wrap_content"android:inputType="phone"
Time of Update: 2018-12-05
Android launcher widget配置<?xml version="1.0" encoding="utf-8"?><favorites xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"> <!-- Far-left screen [0] -->第一屏,根據由幾個屏來定,screen[0]就指第一屏 <!-- Left screen [1
Time of Update: 2018-12-05
android接收和傳送簡訊1.android傳送簡訊 android API 中提供了smsManager類處理簡訊。其中的sendTextMessage(num, null, content, pend, null)函數就是發送 簡訊的方法。第一個參數為目標者手機號、第二個參數為簡訊中心地址 null為預設地址、 第三個參數簡訊的常值內容、第四個參數是一個intent會把發送結果帶回。第五個參數不知,一般為null。
Time of Update: 2018-12-05
1.在service中重寫下面的方法,這個方法有三個傳回值, START_STICKY是service被kill掉後自動重寫建立@Overridepublic int onStartCommand(Intent intent, int flags, int startId) {return START_STICKY;}----------------@Overridepublic int onStartCommand(Intent intent, int flags, int startId)
Time of Update: 2018-12-05
歌詞同步的原理其實很簡單: 歌詞顯示是一個線程, 音樂播放時一個線程,通過播放時間將歌詞顯示進度與播放進度同步起來。 網路標準的歌詞格式是LRC. 我們看下一個LRC文檔,其格式就一目瞭然了. [ti:愛] [ar:小虎隊] [al:華納國語情濃13首] [by:愛上你了音樂網] [02:08.00][00:38.00]把你的心、我的心串一串 [02:11.00][00:41.00]串一株幸運草、串一?同心圓 [02:16.00][00:46.00]讓所有期待未?的呼喚 [0
Time of Update: 2018-12-05
/** * 先聲明一個 IntentFilter 對象 */ private IntentFilter mIntentFilter; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mIntentFilter = new IntentFilter();
Time of Update: 2018-12-05
(1) 調用android 的API: NetworkInterface. getHardwareAddress ()該API的level為9,只有android 2.3以上才有該介面(2) 調用java 的方法: nbtstat/arp一般android不支援這兩個命令(3) 調用Android的API: WifiManager許可權:?1<uses-permission
Time of Update: 2018-12-05
常規的我們可能只考慮QVGA,HVGA,WVGA,FWVGA和DVGA,但是拋去了手機不談,可能平板使用類似 WSVGA的1024x576以及WXGA的1280x768等等。 QVGA = 320 * 240; WQVGA = 320 * 480; WQVGA2 = 400 * 240; WQVGA3 = 432 * 240; HVGA = 480 * 320; VGA = 640 * 480; WVGA = 800 * 480; WVGA2 = 768 *
Time of Update: 2018-12-05
Button button1 = (Button) findViewById(R.id.bt);InputStream stream = null; try { stream = getAssets().open("button_compiled.9.png"); } catch (IOException e1) { e1.printStackTrace(); }Bitmap bitmap = BitmapFactory.de