Time of Update: 2018-12-04
關於Intent執行個體調用:1,調用外部程式: 參數1:Process Name 參數2:Application Class try{ Intent eth = new Intent(); eth.setClassName("com.android.settings", "com.android.settings.EthernetSettings"); startActivity(eth);
Time of Update: 2018-12-04
來自:http://hi.baidu.com/nignt_yoco/item/b6f173700c3df328d7a89cc3具體做法如下:1. 將 /frameworks/base/packages/SettingsProvider/res/values目錄下的defaults.xml檔案內第21行def_screen_off_timeout的值修改為-1,即1<integer name="def_screen_off_timeout">-1</integer>螢幕永遠
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,
Time of Update: 2018-12-04
最近根據看到的資料編譯了一遍Android作業系統的源碼,結果是成功的,但過程是曲折,首先要說的是前提條件,這個很重要,我開始就是因為沒有滿足前提條件而多走了許多彎路。 1、從http://source.android.com擷取最新的Android源碼編譯資料,這個不是下面編譯必須用到的,但確是所有有關Android作業系統源碼的編譯資料中較為準確的。 2、使用ubuntu linux 12.04 LTS,如果你要按照我寫的嘗試一下就選這個,這樣可以節省你的時間;
Time of Update: 2018-12-04
本文將講述如何在Linux平台下使用命令列開發Android應用程式,以及如何建立PhoneGap的android項目,如果你對這此感興趣,請就繼續閱讀本文。首先,讓我們安裝Android SDK(我假設你已經安裝了JDK和Ant)。你可以從在這裡安裝SDK到你的開發平台上。由於我使用的是Ubuntu,所以我下載Linux平台下的SDK到我的主目錄。解壓縮下載檔案,並設定載入可執行檔的路徑:1$ tarxvf android-sdk_r16-linux.tgz2$
Time of Update: 2018-12-04
在Android4.0裡,多了一些API,其中包括怎樣隱藏虛擬按鍵(導覽列),這樣編寫遊戲或一個視頻播放器時,可以設定隱藏虛擬按鍵的參數,達到最佳效果,當然前提是使用的手機是有虛擬按鍵的,如所示下方的方框中。 看一看官方的Android4.0 api說明就明白了。Controls for system UI visibility Since the early days of Android, the system has managed a UI component known as the
Time of Update: 2018-12-04
Android NDK中使用socket的整個過程分為以下幾部分:第一部分: 建立socket並綁定IP和連接埠 #include <sys/select.h> #include <sys/socket.h> #include <arpa/inet.h> #define MAX_DATA_BUF_LEN 10240 int sd = INVALID_SOCKET; sockaddr_in addr_org; //
Time of Update: 2018-12-04
Add permission:<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/><uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT"/>Code:private void setUpShortCut() { Intent intent
Time of Update: 2018-12-04
下面的代碼是mars老師視頻教程裡的代碼,我把它注釋了一下。 建立兩個XML布局檔案main.xml和user.xml。main.xml檔案為系統自動建立main.xml布局檔案代碼: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
Time of Update: 2018-12-04
private String getIp(){ WifiManager wm=(WifiManager)getSystemService(Context.WIFI_SERVICE); //檢查Wifi狀態 if(!wm.isWifiEnabled()) wm.setWifiEnabled(true); WifiInfo wi=wm.getConnectionInfo(); //擷取32位整型IP地址 int
Time of Update: 2018-12-04
這幾天我都在做Android的App,同時學習它的API,我將分享一些我學到的東西,比如: 如何從系統圖庫中選擇圖片。首先,讓我們來看看如何將手機系統圖庫整合到你的App中,然後再從圖庫中選擇圖片來做一些事。例如,在Facebook的App,你就可以直接選擇手機上的圖片上傳到你的設定檔。讓我們來做一個簡單例子,要求:螢幕上顯示一個按鈕和圖片視圖控制項。 點擊“載入圖片”按鈕,將使用者重新導向到Android的圖片庫,在那裡可以選擇一個圖片。
Time of Update: 2018-12-04
在開發工程中線程可以協助我們提高運行速度,Android開發中我知道的線程有四個一個是老生長談的Thread,第二個是asyncTask,第三個:TimetTask,第四個是Looper,四個多線程各有個的有點,Thread的運行速度是最快的,AsyncTask的規範性是最棒的,其它兩個也有自己的優點,下面先貼上三個列子1.Thread與Handler組合,比較常見Handler主要是協助我們來時時更新UI線程這裡在後天載入100張圖片,然後沒載入完成一個用handler
Time of Update: 2018-12-04
這是Android系統來運行updater-scripts的Edify語言的基本介紹。大部分的Edify命名都是函數,當調用這些函數結束的時候,會返回資料給指令碼。當然,你也可以使用這些函數的傳回值來確認成功與否,例如:ifelse(mount("yaffs2", "MTD", "system", "/system") == "system", ui_print("Successfully Mounted!"), ui_print("Mount Failed!");這個命令會嘗試去掛載命名為“s
Time of Update: 2018-12-04
import java.io.IOException;import org.xmlpull.v1.XmlPullParserException;import android.app.Activity;import android.content.res.ColorStateList;import android.content.res.XmlResourceParser;import android.graphics.Bitmap;import
Time of Update: 2018-12-04
很多網友可能發現近期Tencent推出的手機QQ Android版包含了一個開場屏Splash Screen載入效果,通常遊戲或大型軟體開啟時可能需要一個釋放解析資源的過程,需要一個前台的動畫播放和背景邏輯處理線程配合,當然對於簡單的軟體也可以加一個Splash Screen作為美化。在Android平台上如何?呢?首先建立一個Activity,在SetContentView時直接通過ImageView建立一個全屏的圖片,大家還要考慮好解析度和當前裝置一致,onCreate添加代碼如下:new
Time of Update: 2018-12-04
核心代碼:Imei = ((TelephonyManager) getSystemService(TELEPHONY_SERVICE)).getDeviceId();1.加入許可權 在manifest.xml檔案中要添加 <uses-permission android:name="android.permission.READ_PHONE_STATE" />2.代碼 /** * * author test *建立日期 2012-4-29 下午05:02:47
Time of Update: 2018-12-04
Source from: 原文連結1.android系統的關機,重啟代碼位於frameworksasecorejniandroid_os_Power.cpp,裡面有 2.最終會調用到linux中的sys_reboot,所以我們還是可以做到在android中加入重啟功能的; 關機和重啟在Linux Kernel中的哪些函數裡實現。
Time of Update: 2018-12-04
這內容挺用的,特別是需要調節亮度的程式,自己收藏起來,呵呵。這段代碼不只能改變當前的Activity,也可以改變整個System的亮度代碼:package com.jimmy;import android.app.Activity;import android.os.Bundle;import android.provider.Settings;import android.view.Window;import android.view.WindowManager;import android.
Time of Update: 2018-12-04
定義相關變數private Handler uHandler;private TimerTask task;private Timer timer = new Timer();;實現相關代碼Handler 部分:用於處理接收到的訊息,根據msg.what部分進行相關訊息處理,其中訊息有來之Timer與線程 uHandler = new Handler(){ @Override public void handleMessage(Message msg)
Time of Update: 2018-12-04
讀取電池資訊的android代碼:package org.example.itester;import android.content.BroadcastReceiver;import android.content.Context;import android.content.Intent;import android.content.IntentFilter;import android.graphics.Color;import