Time of Update: 2018-12-05
AsyncTask是抽象類別,子類必須實現抽象方法doInBackground(Params... p) ,在此方法中實現任務的執行工作,比如串連網路擷取資料等。 通常還應該實現onPostExecute(Result r) 方法,因為應用程式關心的結果在此方法中返回。需要注意的是AsyncTask一定要在主線程中建立執行個體。AsyncTask定義了三種泛型型別 Params,Progress和Result。 * Params 啟動任務執行的輸入參數,比如HTTP請求的URL。
Time of Update: 2018-12-05
•android:theme="@android:style/Theme.Dialog" 將一個Activity顯示為能話框模式•android:theme="@android:style/Theme.NoTitleBar" 不顯示應用程式標題欄•android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 不顯示應用程式標題欄,並全屏•android:theme="Theme.Light"
Time of Update: 2018-12-05
if (mIntentReceiver == null) { mIntentReceiver = new MissedCallIntentReceiver(); final IntentFilter myFilter = new IntentFilter(); myFilter.addAction("com.android.phone.NotificationMgr.MissedCall_intent");
Time of Update: 2018-12-05
又是一周沒有學習了,廢話不多說,直接上XML檔案代碼: <?xml version="1.0" encoding="utf-8"?><TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:stretchColumns=
Time of Update: 2018-12-05
see the effect in attached file.Code here:package com.sina.android.acx;import android.app.Activity;import android.app.ProgressDialog;import android.os.Bundle;public class AClientXActivity extends Activity { /** Called when the activity is first
Time of Update: 2018-12-05
工作中遇到一些項目需要把表單顯示在最上層,像來電彈窗顯示電話號碼等資訊或攔截簡訊資訊顯示給使用者,我們想這些資料放在最上層,activity就滿足不了我們的需求了,有些開發人員使用了迴圈顯示Toast的方式,toast是不能獲得焦點的,這種方法是不可取的。這個時候,我們如何處理呢? 原來,整個Android的視窗機制是基於一個叫做
Time of Update: 2018-12-05
Android查看sqlite資料庫內容的方法 Android中可以採用sqlite資料褲來儲存資料,是Google卻沒有直接給我們提供相關工具來管理資料庫裡的資料。如果不能直接通過工具來查看,那我們就把資料庫從手機/模擬器裡面拷貝出來用工具查看,下面是步驟1.確認資料庫的位置我們可以通過eclipse的DDMS外掛程式來訪問手機的部分目錄資料庫檔案位於/data/data/你的程式的包名/databases/
Time of Update: 2018-12-05
1.Gallery可以拖動圖片,實現很炫的效果,如下,可以向左右拖動:2.布局代碼<?xml version="1.0" encoding="utf-8"?><Gallery xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/Gallery" android:layout_width="fill_parent"
Time of Update: 2018-12-05
前段時間美工設計了一個控制項,辛辛苦苦花了2天才弄出來,結果偶然看到了網上原來有開源項目...這個控制項可以上下滾動,通過adapter可以拿到中間選中部分的值。。先上個先:再上代碼。。這個是控制項的view注意哦:這個只是中間的白色的滾動部分和綠色部分的代碼,周圍的背景需要自己用xml布局。。圖片啥的就不發了,畢竟是在公司做的。。。而且我上的圖是用了2個這個控制項排在一起的效果public class ScrollListView extends View {public static
Time of Update: 2018-12-05
分享到新浪微博,折騰了大半個月,現在終於弄出來了,心裡的那個爽呀,太痛快了,哈哈!!廢話少說,首先是認證,1.進入新浪微博提供的開放平台http://open.weibo.com/ 註冊新浪帳號。2.點擊’我是開發人員‘,建立一個應用,得到CONSUMER_KEY和CONSUMER_SECRET,儲存這兩個值。 3.找到相關的API介面文檔,下載android版的SDK weibo4android-1.2.0.zip
Time of Update: 2018-12-05
本文按鍵是指真實的物理鍵,如HOME,BACK等等。瞭解這些鍵的響應處理過程,對於分析ANDROID的事件處理流程也是有一定協助的。在linux kernel,
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
// 放大縮小圖片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
1. 術語和概念術語說明備忘Screen size(螢幕尺寸)指的是手機實際的物理尺寸,比如常用的2.8英寸,3.2英寸,3.5英寸,3.7英寸。指手機螢幕對角線長度。摩托羅拉milestone手機是3.7英寸Aspect Ratio(寬高比率)指的是實際的物理尺寸寬高比率,分為long和nolongMilestone是16:9,屬於longResolution(解析度)和電腦的解析度概念一樣,指手機螢幕縱、橫方向像素個數Milestone是854*480DPI(dot per
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
下面的代碼是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" android:orientation="vertical"
Time of Update: 2018-12-05
要實現檔案關聯,首先修改AndroidManifest.xml,AndroidManifest例子如下 <?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.sample" android:versionCode="1"
Time of Update: 2018-12-05
GalleyView Galley是畫廊的意思,一般只在圖片顯示中使用,而且也不常用。1)Android
Time of Update: 2018-12-05
正常的Dialog快顯視窗,當點擊視窗外圍時關閉彈出的視窗,這個在很多彈出式的Activity上很為實用! dialog.xml 快顯視窗的介面布局: <?xml version="1.0" encoding="utf-8"?><LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent"
Time of Update: 2018-12-05
package lyh.Demo1;import java.util.Calendar;import android.app.Activity;import android.os.Bundle;import android.widget.TextView;public class Demo1 extends Activity {private TextView yearText;private TextView monthText;private TextView