原创 Android(Java):在textview中顯示富文本
動態更改一行文字中某個文字時 有三種方法 1.使用TextView拼接........ /** * 更新下載數目 * @param allnum * @param loadednum * @param loadingnum
原创 Android(Java):Android中常用的代碼
1代碼中設置margin RelativeLayout.LayoutParams margin = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PA
原创 Android(java):database disk image is malformed (code 11)
public class DatabaseHelper extendsSQLiteOpenHelper { //類沒有實例化,是不能用作父類構造器的參數,必須聲明爲靜態 private static final
原创 Android(Java):滑動刪除實現——重寫onTouch
public class RecordFragment extends Fragment{ private int userId; private List datas; private View mVNorecord;
原创 Android(Java):focus
android中,要使控件獲得焦點,需要先setFocus,再requestFocus。 以Button爲例: btn.setFocusable(true); btn.set
原创 Android(Java):md5加密
/** * md5編碼 * @param input * @return result */ public static String md5HexDigest(String input,String salt){
原创 Android(Java):泛型與反射
private <T> T getFromList(List list,int id){ try { if(null==list||lis
原创 Android(Java):按鈕複選框點中效果
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" a
原创 Android(Java):對應用進行單元測試
在實際開發中,開發android軟件的過程需要不斷地進行測試。而使用Junit測試框架,側是正規Android開發的必用技術,在Junit中可以得到組件,可以模擬發送事件和檢測程序處理的正確性。 第一步:首先在AndroidManifes
原创 Android(Java):fragment
快速來回切換會產生java.lang.IllegalStateException: Fragment already added問題,現在改成左側功能菜單的處理方式,使用fragment的show hide方法。 <?xml ver
原创 Android(Java):切換3g提醒
<receiver android:name=".broadcast.Switch3GReceiver" > <intent-filter> <action android:name
原创 Android(Java):長時間未登錄提醒
@Override protected void onPause() { // TODO Auto-generated method stub super.onPause(); currentTime = System.cu
原创 Android(Java): 獲得設備唯一ID
/** * 獲得設備唯一ID * @return */ public static String getDeviceUUID(Cont
原创 Android(Java):音量調節
設置音量的方法也很簡單,AudioManager提供了方法: publicvoidsetStreamVolume(intstreamType,intindex,intflags)其中streamType有內置的常量,去文檔裏面就可以看
原创 Android(Java):http options
/** * 檢測軟件更新 */ public void checkUpdate(boolean showAlert, final View