怎麼知道手機使用了多少流量呢,android2.2之後為我們提供了TrafficStats這個類,可以用來解決這個問題。下面和大家分享一下代碼:package com.zyb.flow;import android.app.Activity;import android.net.TrafficStats;import android.os.Bundle;public class MainActivity extends Activity { /** Called when the
最近協助老師開發一個程式,需要調用webservice服務,找到了以下資料,與大家分享。While working on a new mobile applicationfor one of my clients, I had to make calls out to web services to retrieve(取回) data. Using the Android framework tomake these calls was very cumbersome(難處理的).
最近在作一個Android的搜尋方塊,類似於用到了EditText,但是如何在EditText中嵌入一個提示性的圖片呢?查看了SDK文檔,在EditText中沒有找到相關屬性,最終在TextView中找到了android:drawableLeft這個屬性,官方的解釋是:The drawable to be drawn to the left of the
最近公司項目上線之前用Monkey測試,一直出這個錯誤:Exception: View not attached to window manager。特別糾結,後來總結了下,就是在Activity消失的情況下,還調用dialog的dismiss方法就出這個錯誤了。我的解決辦法是:判斷當前的activity.isFinishing() + !=null + isShowing(),這三種方式去防止發生這個問題。Exception: View not attached to window
今天學習下Paint這個類,決定從看源碼開始學習。先看類的定義就很有特點:public class Paint extends _Original_Paint ,後面這個_Original_Paint 是怎麼個回事,希望大家解釋,我不懂。用到了Style,這個是一個內部的枚舉類,有3種:FILL (0), STROKE (1), FILL_AND_STROKE (2); /** * The Style specifies if the primitive being drawn