原创 我的友情鏈接

51CTO博客開發

原创 子線程中處理UI,拋異常 android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original

activity中 處理子線程(工作線程)有兩原則:    1. Do not block the UI thread (不要阻塞UI線程)    2. Do not access the Android UI toolkit from o

原创 我的友情鏈接

51CTO博客開發

原创 sqlsever,mysql,orcale,判斷null值方法

sqlsever:ISNULL ( check_expression , replacement_value )參數 check_expression 將被檢查是否爲 NULL的表達式。check_expression 可以是任何類型的。

原创 Several ports (8005, 8080, 8009) required by Tomcat v7.0 Server at localhost are解決方法

tomcat 運行不了 拋異常Several ports (8005, 8080, 8009) required by Tomcat v7.0 Server at localhost areSeveral ports (8005, 8080

原创 關於EditText密碼框,切換顯示或隱藏

直接上代碼private EditText edt; private CheckBox btn; @Override protected void onCreate(Bundle savedInstanceState) { su

原创 android 設置控件的字體

首先,把需要使用的字體的ttf文件 copy到assets目錄中,(資源文件比較多,建議建個文件夾來管理)然後需要通過代碼設置:TextView tvTag1 = (TextView) findViewById(R.id.tvTag1);

原创 android中 碎片的生命週期

碎片的生命週期:    1 . onAttach() : 當碎片與活動建立關聯是調用    2 . onCreateView() : 用於創建碎片的視圖    3 . onActivityCreated() : 當活動的onCreate()

原创 android中 activity的生命週期

activity的生命週期:    1 : onCreate()        --活動第一次被創建時調用,應該在這方法中完成活動初始化操作,如:加載佈局,綁定事件    2 : onStart()        --活動由不可見變爲可見的

原创 android 設置LinearLayout,RelativeLayout等等layout的高和寬

兩種方法://第一種: LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, 100); /

原创 List<HashMap<String,String>> list, 根據hashmap中的某個鍵的值排序

//可以使用Collections.sort(List list, Comparator c)來實現這裏舉例hashmap中存的一個時間的鍵值,按照時間的值來排序//先寫個類實現Comparator,並重寫compare(Object o1

原创 關於listview getview()中 每個item中的按鈕的 點擊事件,獲取當前item

public View getView(int position, View convertView, ViewGroup parent) {    if (convertView != null) {       view = conv

原创 webview 獲取當前html的title以及返回時title的變化處理

webview中都會需要做個header頭,上面有個返回按鈕和當前頁面的標題首選處理獲取標題功能 webview 封裝好了一個函數,直接調用就可以 TextView webview_title = (TextView) findViewBy

原创 activity設置成dialog後,再設定其顯示位置和高寬

WindowManager m = getWindowManager();            Display d = m.getDefaultDisplay();  //爲獲取屏幕寬、高                        L

原创 android請求http 關於connection.getResponseCode() 等於-1的問題

直接通過瀏覽器輸入鏈接請求服務端是正常的, 如果用android端 使用HttpURLConnection請求,  得到的getResponseCode() 會返回-1,主要問題在於線程, 要單獨走一個線程, 不能直接走主線程解決方法有兩種