原创 Execution failed for task ':dexDebug'

錯誤 在 Android Studio 中用 compile 導入開源庫時報了以下錯誤: Error:Execution failed for task ':dexDebug'. > com.android.ide.common

原创 Json實體類快速生成插件 GsonFormat

寫在前頭:本插件只適用 android studio和 Intellij IDEA 工具,eclipse 的少年無視我吧!!! 這是一個根據JSONObject格式的字符串,自動生成實體類參數. github jetbrains

原创 Android調用微信掃一掃

在自己的應用中打開微信掃一掃代碼: private void toWeChatScan() { try { //利用Intent打開微信 Uri uri =

原创 IllegalStateException: Can not perform this action after onSaveInstanceState

今天使用Fragment的時候,出現了這個錯誤 IllegalStateException: Can not perform this action after onSaveInstanceState:   E/AndroidRu

原创 Android 打開外部應用(微博/微信/QQ等)

跳轉微信首頁 Intent intent = new Intent(); ComponentName cmp = new ComponentName("com.tencent.mm","com.tencent.mm.ui.Laun

原创 Android Template(模板) 編寫

轉載自:http://blog.csdn.net/zhaodai11?viewmode=contents 當我們在使用AndroidStudio新建工程,模塊或者類時,其實AndroidStudio是已經給我們提供好了一些模板。例

原创 Android五種數據傳遞方法彙總

Android開發中,在不同模塊(如Activity)間經常會有各種各樣的數據需要相互傳遞,我把常用的幾種 方法都收集到了一起。它們各有利弊,有各自的應用場景。 我現在把它們集中到一個例子中展示,在例子中每一個按紐代表了一種實

原创 Android 自定義Toolbar/ActionBar視圖左邊有空白

最近自定義Toolbar之後,發現左側不能完全填充,總是留一點空白,經過查看新發布的V7的支持包中的style發現瞭解決方法。 查看Wiget.AppCompat.Toolbar的parent,如下: <style nam

原创 Gridview auto_fit 屬性無效

之前在項目中用到GridView,想根據GridView的寬度和item的大小來自動排版顯示每排的item數量。於是乎將GridView下的 android:numColumns 屬性設置爲 auto_fit ,如下: <Gr

原创 Unknown facet type:'android', Unknown facet type:'android-gradle'

Android studio 異常描述: “2 facets cannot be loaded. You can mark them them as ignored to suppress this error notif

原创 Android 日誌打印工具類

Android 中的日誌工具類 Log (android.util.Log) 方法 含義 Log.v() Verbose Log.d() Debug Log.i() Info Log.w() Warn

原创 Android 6.0 運行時權限處理

運行時權限介紹 Android 6.0在我們原有的AndroidManifest.xml聲明權限的基礎上, 又新增了運行時權限動態檢測,以下權限都需要在運行時判斷: 身體傳感器 日曆 攝像頭 通訊錄 地理位置 麥克風 電話 短

原创 Mac環境下對android app抓包

環境 Mac電腦 Android手機 抓包工具 Charles 步驟 一、安裝 Charles 官網鏈接:http://www.charlesproxy.com/ 破解版:http://www.waitsun.com/cha

原创 Android 6.0 的getColor()方法過時

解決方式 將 getColor()方法替換爲: ContextCompat.getColor(context, R.color.my_color) 過時的getColor()方法源碼 @ColorInt @Depr

原创 Android 7.0新特性

Android 7.0 開發者版本 Android 7.0 Nougat 爲用戶和開發者引入多種新功能。本文重點介紹面向開發者的新功能。 請務必查閱 <href="/about/versions/nougat/android-7.0-c