Time of Update: 2018-12-05
今天介紹一下在Android中實現通話接通後震動提示,這裡通話主要是針對撥出的電話.想要在接通的時候給出震動提示那麼我們就需要知道通話何時是被接通的.這樣才能在進入該狀態後給出提示.但SDK中並沒有直接獲得這種狀態的方式.首先我們看一下SDK中電話語音類為我們提供了哪些通話狀態.SDK中的TelephonyManager類提供了3種電話的狀態.CALL_STATE_IDLE 空閑狀態CALL_STATE_OFFHOOK 摘機狀態CALL_STATE_RINGING
Time of Update: 2018-12-05
列印i、w和e選項:I/ActivityManager( 62): Starting: Intent { cmp=com.moming.marten/.SystemPlayerActivity (has extras) } from pid 415W/drawable( 415): Bad element under <shape>: backgroundI/StagefrightPlayer( 34):
Time of Update: 2018-12-05
在Android中要讓一個程式的介面始終保持一個方向,不隨手機方向轉動而變化的辦法: 只要在AndroidManifest.xml裡面配置一下就可以了。在AndroidManifest.xml的activity(需要禁止轉向的activity)配置中加入android:screenOrientation=”landscape”屬性即可(landscape是橫向,portrait是縱向)。例如: <?xml version="1.0" encoding="utf-8"?>
Time of Update: 2018-12-05
DT是用於開發Android的Eclipse外掛程式,ADT想要在Eclipse上正常使用的關鍵是它們的版本要相容。因此推薦線上安裝ADT外掛程式,它會根據Eclipse版本自動找到能夠適應的版本的。1.線上安裝ADT外掛程式啟動Eclipse,如果是Eclipse3.5或Eclipse3.6選擇“Help”>“Install New Software...”,如果Eclipse3.4及以下版本菜單是“Help”>“Software
Time of Update: 2018-12-05
運行一個Android小程式時提示: No compatible targets were found Do you wish to a add new Android Virtual Device ?未發現有可相容的目標(程式),你是不是希望添加一個AVD?這個問題最主要的原因還是項目版本與建立的模擬器(AVD)版本不一樣造成的, 有時候我們把之前建那的模擬器刪除了,那你再次建好模擬器的時候,運行程式時有可能會提示No compatible targets were found, Do
Time of Update: 2018-12-05
今天程式在樂phone上測出來一個bug:從頁面內退出程式時候第一次退不出去,需要第二次推出才可以。在DDMS上跟蹤發現報兩個錯誤:08-19 13:51:18.286: ERROR/AndroidRuntime(5765): java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=
Time of Update: 2018-12-05
1. 首先啟動android模擬器。2. 開啟cmd命令列視窗。 輸入 adb
Time of Update: 2018-12-05
// 放大縮小圖片public static Bitmap zoomBitmap(Bitmap bitmap, int w, int h) {int width = bitmap.getWidth();int height = bitmap.getHeight();Matrix matrix = new Matrix();float scaleWidht = ((float) w / width);float scaleHeight = ((float) h /
Time of Update: 2018-12-05
Android編譯系統的架構: 分析Android編譯系統,你會發現,Android編譯系統完成的並不僅僅是對目標(主機)系統二進位檔案、java應用程式的編譯、連結、打包等,而且還有包括產生各種依賴關係、確保某個模組的修改引起相依賴的檔案的重新編譯連結,甚至還包括目標檔案系統的產生,設定檔的產生等,因此Android編譯系統具有支援多架構(linux-x86、windows、arm等)、多語言(彙編、C、C++、Java等)、多目標、多編譯方式。這些目標和結構決定其架構也很重要。
Time of Update: 2018-12-05
這兩個方法是網上拷別人的,分別用來得到可用記憶體和記憶體總數,這樣我們就可用得到了已用記憶體數。private long getAvailMemory(Context context){// 擷取android當前可用記憶體大小ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);MemoryInfo mi = new
Time of Update: 2018-12-05
ScrollView01.java: package com.ScrollView01;import android.app.Activity;import android.os.Bundle;import android.os.Handler;import android.view.KeyEvent;import android.view.View;import android.widget.Button;import android.widget.LinearLayout;import
Time of Update: 2018-12-05
Android 中壁紙管理主要由 WallpaperManager 這個類負責 Provides access to the system wallpaper. With WallpaperManager, you can getthe current wallpaper, get the desired dimensions for the wallpaper, set thewallpaper, and more. Get an instance of WallpaperManager
Time of Update: 2018-12-05
DatePicker01.java: package com.DatePicker01;import java.util.Calendar;import android.app.Activity;import android.app.DatePickerDialog;import android.app.TimePickerDialog;import android.os.Bundle;import android.view.View;import
Time of Update: 2018-12-05
原文地址:http://www.cmath.net/read.php?tid=57在開始讀這篇文章之間,介意你先閱讀Android開發入門(四)之介面Activity。Activity之間的跳轉分為兩種一種是顯示的,另一種是隱式跳轉,推介使用隱式跳轉,不過本文兩種都會講解。在Android開發入門(四)之介面Activity中源碼中已包含了顯式跳轉。首先在Android開發入門(四)之介面Activity中已有一個Activity,這裡需在再建一個Activity。第一步:在項目中res/lay
Time of Update: 2018-12-05
首先,設定要覆蓋在最上方的dialog的view<?xml version="1.0" encoding="utf-8"?><RelativeLayout android:background="@drawable/navigater_bg" android:padding="0.0dip" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://
Time of Update: 2018-12-05
Chronometr是一個簡單的定時器,你可以給它一個開始時間,並以此定時,或者如果你不給它一個開始時間,它將會使用你的時間通話開始。預設情況下它會顯示在當前定時器的值得形式"分:秒" 或"MM:SS", 或者可以使用set(字串)的定時器值到一個任一字元串重要屬性android:format 定義時間的格式如: hh:mm:ss重要方法setBase(long base)//設定倒計時定時器setFormat(String
Time of Update: 2018-12-05
CheckBox,也就是多項選擇。Android中提供了ChechBox控制項,使用起來非常方便。CheckBox效果main.xml源碼<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical"
Time of Update: 2018-12-05
public class ShortcutUtil {/** * 建立捷徑 * * @param context */public static void createShortcut(Context context, Class<?> target) {// <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />Intent intent = new
Time of Update: 2018-12-05
Android 原始碼獲得過程中,repo sync經常失敗的解決辦法: 主要參見:http://www.tonypig.net/?p=9998 ,感謝作者; 1. 修改repo 將REPO_URL中的git:修改為http:2. 在你要下載原始碼的目錄(這裡是 Android_SOURCE) 中,運行指令碼:repo init -u http://android.git.kernel.org/platform/manifest.git -b
Time of Update: 2018-12-05
覺得字串可能長短不一,不能完全顯示,老大說讓做成滾動效果那種,本來以為很難,不過萬能的baidu告訴我不難,如下而已:TextView加三行屬性android:singleLine="true"android:ellipsize="marquee" android:marqueeRepeatLimit="marquee_forever" ps:下面這個layout我驗證過,可以滾動的<?xml