原创 RecyclerView的使用_android

RecyclerView是v7提供的控件佈局:<android.support.v7.widget.RecyclerView android:id="@+id/rlv_helper_list" android:layout_width="

原创 GitLab push代碼時報:the remote end hung up unexpectedly

http post提交請求大小最多爲10M 調整post的大小,GitBash中執行這句代碼 git config http.postBuffer 524288000

原创 無符號byte數據操作,多個無符號byte合併,byte解析成多個二進制數據

獲取到流中byte數據後,對byte進行需要的各種操作。 查了網上許多方式,實現了對byte的一些操作: byte數據操作: public class DataTypeConvert {     /**      * byte 的每一bi

原创 SQLite使用_android

SQLite數據庫 SQLite簡介: Sqlite是一款輕量級的關係型數據庫。關係型數據庫以行和列的形式存儲數據,以便於用戶理解。   關係型數據庫:是指採用了關係模型來組織數據的數據庫 非關係型數據庫:網狀模型、對象模型、半結構化模型

原创 jdk1.7 finished with non-zero exit value 1

Error:Execution failed for task ':app:transformClassesWithDexForDebug'.> c

原创 Conversion to Dalvik format failed with error 1

打包時 出現了這個錯誤。去這裏 解決了http://blog.sina.com.cn/s/blog_5de73d0b0101csok.html

原创 activity半背景透明的一些小坑

因爲需要用到一個透明的activity,就摸索着試了試,遇到了一些小坑。總結下: 沒有標題欄的頁面 /** * Created by gj on 2016/8/2. */ public class ShareActivity ext

原创 andorid TextView怎麼多行顯示不同顏色

TextView多行設置不同顏色字體 String startHtmlStr="<font color=\'#ff0000\'>紅色</font><br/><font color=\'#00ff00\'>綠色</font>";  Stri

原创 android 自定義Dialog怎麼設置外邊背景

<item name="android:backgroundDimEnabled">true</item> 設置爲true之後 外框加LinearLayout,設置LinearLayout的背景即可 點贊 收藏

原创 Unable to add window -- token null is not for an application

在使用一個自定義dialog報錯Unable to add window -- token null is not for an application captchaDialog = new GyHardCaptchaDialog(th

原创 Dialog中使用handler時報:Can't create handler inside thread that has not called Looper.prepare()

Dialog中使用handler時報:Can't create handler inside thread that has not called Looper.prepare() dialog的show方法前後加,Looper.prep

原创 java版CRC16(Modbus)校驗_2016_3_21

在TCP連接時,傳遞的數據需要加上CRC校驗位,驗證數據的完成性。 而在獲取到服務器端的數據時,樓主偷懶了,未校驗CRC WORD ModbusCRC(BYTE * pData, BYTE len) {     BYTE byCRCHi

原创 socket實現TCP通信_TCP連接android與單片機(2016_03_21)

最近做了一個TCP連接android與單片機的項目。記錄一下。 TCP連接對象 首先是TCP連接,以前沒有做過,摘抄的同事項目中TCP連接對象。 public class TCPChannel {     private SocketCh

原创 Android自定義控件

Android自定義控件 1.組合控件。 幾個現有控件,組合起來,達到使用的目的。初始化時,新佈局填充到控件上。 組合控件定義一個密碼輸入框,右側可以點擊圖標,來切換密碼是顯示或隱藏。 佈局文件:由editText和img組成。 <Rel

原创 NavigationView的使用

簡介: NavigationView是Google在Android5.0之後,推出的左側側拉菜單控件。 如何使用: item佈局文件 <?xml version="1.0" encoding="utf-8"?> <menu xmlns: