Delayed exit application timer를 이용한 application exit (다른 내부 async 종료를 잠시 기다림) new Timer().schedule(new TimerTask() { public void run() { finishAffinity(); android.os.Process.killProcess(android.os.Process.myPid()); System.exit(0); } }, 500); android source 2020.01.16
ask Permission program start 시에 필요한 permission 물어보고 받아 내기, 실수로 거부되었을 경우 다시 물어보는 logic 있음 refer to myHolyBible.apk askPermission(); ArrayList permissions = new ArrayList(); private final static int ALL_PERMISSIONS_RESULT = 101; ArrayList permissionsToRequest; ArrayList permissionsRejected = new ArrayList(); private void askPermission() { permissions.add(Manifest.permission.WRITE_EXTERNAL_STORAGE); permissions.a.. android source 2020.01.12
onSwipeTouchListener onSwipeTouchListner.java package com.urrecliner.markupphoto; import android.content.Context; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; import static com.urrecliner.markupphoto.Vars.utils; public class OnSwipeTouchListener implements View.OnTouchListener { private GestureDetector gestureDetector; OnSwipeTouchListener(Context c) { gestureDetect.. android source 2020.01.04
get physical screen width dots refer to GXCount.apk int getScreenWidth() { Display display = mActivity.getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); return size.x; } android source 2020.01.03
shared preference save, get refer to MakrUpPhoto.apk SharedPreference sharePrefer; sharePrefer = getApplicationContext().getSharedPreferences("myPhoto", MODE_PRIVATE); // to get activeShortFolder = sharePrefer.getString("activeShortFolder", "DCIM/Camera"); // to save SharedPreferences.Editor editor = sharePrefer.edit(); editor.putString("activeShortFolder", activeShortFolder); editor.apply(); editor.commit(); android source 2019.10.10
getColor() set color from resource file color.xml btn03.setBackgroundColor( getResources().getColor(android.R.color.holo_blue_dark,mainContext.getTheme()); android source 2019.09.30
To know whether SD card is mounted public class SDCard { //Check If SD Card is present or not method public boolean isSDCardMounted() { if (Environment.getExternalStorageState().equals( Environment.MEDIA_MOUNTED)) { return true; } return false; } } android source 2019.09.29
Horizontal Wheel Wheel 을 가로로 보여 주고 선택할 수 있는 class 표시될 value를 array로 준비 meterLists = new ArrayList(); meterLists = Arrays.asList(meterTexts); refer to MultiMetronome.app call 하는 법 android.support.v7.app.AlertDialog.Builder builder = new android.support.v7.app.AlertDialog.Builder(mActivity); View theView = View.inflate(mContext, R.layout.wheel_view, null); WheelView wV = theView.findViewById(R.id.wheel); wV.setIte.. android source 2019.09.06
Customized AlertDialog AlertDialog customized (OK button Size, color change) refer to MultiMetronome.app android.support.v7.app.AlertDialog.Builder builder = new android.support.v7.app.AlertDialog.Builder(mActivity); View theView = View.inflate(mContext, R.layout.wheel_view, null); builder.setView(theView) .setPositiveButton("OK가 크게",new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface.. android source 2019.09.06
tts speak tts speak refer to sayNotiText.apk void initiateTTS(Context context) { mContext = context; mTTS = null; mTTS = new TextToSpeech(context, new TextToSpeech.OnInitListener() { @Override public void onInit(int status) { if (status == TextToSpeech.SUCCESS) { int result = mTTS.setLanguage(Locale.KOREA); if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) { utils... android source 2019.08.17