原创 Android 清單文件設置禁止 軟鍵盤彈出無效

清單文件 android:windowSoftInputMode=“adjustPan|stateHidden” 這個屬性發現無效 這時候去查找原因可能是其他地方設置了 getWindow().setSoftInputMode(W

原创 運行沒問題 打包出現Execution failed for task ‘:app:transformClassesAndResourcesWithProguardForRelease‘.

點擊上面看詳細信息如下圖 解決方案: build日誌網上找警告Warning Warning: com.iflytek.voiceads.update.d.c: can’t find referenced method ’ 在

原创 java.lang.OutOfMemoryError :Coldnot not allocate JNI Env

先說一下 我的需求: 某一個頁面需要 每隔三秒進行刷新,刷新的數據是從網絡上面拿下來的。而我每次刷新的時候 要十五條數據,所以我沒隔三秒就會去請求數據。 分析一下異常的原因: 原本 我以爲是線程的問題,因爲我用的是異步,每次請求的

原创 android scrollview組件禁止滑動的方法

今天遇到一個需求,項目使用攝像頭掃碼支付,但是那個控件不能顯示在屏幕上面 後來通過 scrollview組件禁止滑動的方法實現了 java代碼控制: ScrollView scrollView = (ScrollView)thi

原创 簡單實現倒計時功能

/** 倒計時60秒,一次1秒 */ CountDownTimer timer = new CountDownTimer(61*1000, 1000) { @Override public void onTick(lo

原创 獲取藍牙地址的工具類,包括wifi,Android6.0以上

import android.content.Context; import android.content.pm.PackageManager; import android.net.wifi.WifiInfo; import

原创 Android RecyclerView 網格顯示正方形

使用recyclerView顯示縱向滑動的網格列表,只需要設置 mListView.setLayoutManager(new GridLayoutManager(context,4)); public class MyLayout

原创 Android 獲取屏幕寬高的方法

//獲取屏幕的高 public static int getScreenHeight(Context context){ WindowManager wm = (WindowManager) context.getSyst

原创 BluetoothUtil

import android.app.Activity; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothClass; im

原创 Manifest merger failed : Attribute application@icon value=(@mipmap/gzds) from AndroidManifest.xml:

問題描述: 這裏不僅限於icon這一項,可能會出現其它的屬性衝突錯誤。 問題出現的原因是本工程的屬性和第三方工程裏的屬性名稱相同,AS在編譯的時候未做區分,導致合併失敗。 在application頭裏添加: tools:repla

原创 簡單的MD5

import java.security.MessageDigest; public class MD5 { private MD5() {} public final static String getMessageDiges

原创 Android從一個APP跳轉到另一個APP的主界面或某頁面

private void startNormalTest() { String packageName = “應用包名”; String activity = “應用包名.類名”; ComponentName component

原创 Android 6.0以上的APK安裝

關於 android 7.0 之前的 apk安裝,需要注意設置 Intent.FLAG_ACTIVITY_NEW_TASK 就好 Intent intent = new Intent(Intent.ACTION_VIEW); Ur

原创 Android點擊通知欄 ,移除通知

通過點擊系統通知欄移除 通知只需要一個方法 Notification notification = new Notification(); notification.setAutoCancel(true); 下面是整個系統彈窗的方

原创 Android 通過文件路徑直接修改文件名

今天遇到一個錄製視頻需要修改文件路徑的,因爲開始錄製視頻的時候已經生成文件名稱纔去錄製視頻,解決辦法就是錄製視頻結束後根據文件路勁修改文件名 下面直接貼代碼 /** * 2 * 通過文件路徑直接修改文件名 * 3