android studio svn commit changelist delete
在提交程式碼的時候,會提示Partial Commit of Active Changelist,一般會選擇Yes,但如圖,我這樣強迫症患者,就想刪掉 解決方案:
The APK file does not exist on disk.Error while Installing APK
執行apk,直接報這個錯誤,clean也無效 解決方案:
Android Studio獲取SHA1
開發地圖,在他們的後臺需要填SHA1,以前是填MD5值,MD5值獲取很簡單,那SHA1怎麼獲取呢? 步驟如下: 1、全域性配置jdk1.8.0_45\bin(或cd進入bin目錄) 2、keytool -v -list -keystore 你的keystore路徑 3、輸入祕鑰庫口令:如果沒設定,這裡就是空,直接回車就進去了。
Android 6.0 Dialog text doesn't appear
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("退出登入");
builder.setMessage("您確定要退出登入嗎?");
builder.setNegativeButton("取消", null);
builder.setPositiveButton("確定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
HashMap params = new HashMap();
postData(API.LOGOUT, params, false, new ResponseCallBack(Settingctivity.this) {
@Override
public void onSuccessResponse(String bean, String msg) {
}
@Override
public void onFailResponse(String msg) {
}
}, null, null, true);
}
});
builder.create().show(); 複製程式碼
正常這樣是沒問題,但是在Android 6.0發現文字不顯示,如圖:
解決方案:
/**
* http://stackoverflow.com/questions/33228454/android-6-0-dialog-text-doesnt-appear
*
* @param context
* @return
*/
public static AlertDialog.Builder alertDialogBuilder(Context context) {
AlertDialog.Builder builder;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
builder = new AlertDialog.Builder(context, android.R.style.Theme_Material_Light_Dialog_Alert);
} else {
builder = new AlertDialog.Builder(context);
}
return builder;
}複製程式碼
然後初始化
AlertDialog.Builder builder = alertDialogBuilder(this);複製程式碼
URLEncoder.encode
如果網路請求,引數包含了中文,那需要URLEncoder轉下
URLEncoder.encode(引數值 "utf-8")複製程式碼
單擊返回鍵兩次退出
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
long secondTime = System.currentTimeMillis();
if (secondTime - firstTime > 800) {//如果兩次按鍵時間間隔大於800毫秒,則不退出
Toast.makeText(MainActivity.this, "再按一次退出程式...",
Toast.LENGTH_SHORT).show();
firstTime = secondTime;//更新firstTime
return true;
} else {
//否則退出程式操作
}
}
return super.onKeyUp(keyCode, event);
}複製程式碼
……
更多實戰經驗見我的部落格:wuxiaolong.me/2015/08/10/…