public static String humanReadableByteCount(long bytes, boolean si) {

    int unit = si ? 1000 : 1024;

    

    if (bytes < unit) return bytes + " B";

    int exp = (int) (Math.log(bytes) / Math.log(unit));

    String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp-1) + (si ? "" : "i");

    return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre);

  }

function setLog($msg = ""){

  $filePath = "파일이 생성될 경로";

  $fileName = "my_".date("Ymd").".log";               //파일명

  $logFile  = @fopen($filePath.$fileName, "a");


  if(!$logFile) {

    echo "\n not write permition \n\r";

  }


  fputs($logFile, $msg);

  fclose($logFile);

}



String root = Environment.getExternalStorageDirectory().toString();
File myDir = new File(root + "/Download");
myDir.mkdirs();

String fname = "image.jpg";

File file = new File (myDir, fname);
if (file.exists ()) file.delete ();
try {
FileOutputStream out = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
out.flush();
out.close();

Toast.makeText(mContext, fname + "다운로드 되었습니다", Toast.LENGTH_SHORT).show();

} catch (Exception e) {
e.printStackTrace();
}


'android' 카테고리의 다른 글

pendingIntent Flag 옵션  (1) 2018.02.02
TextView 선택 복사  (0) 2018.01.19
웹뷰 바로 전의 URL 가져오기  (0) 2017.12.12
코드로 원 그리기  (0) 2017.12.11
마테리얼 디자인 정리가 잘되어있어 올립니다.  (0) 2017.12.02
WebBackForwardList webBackForwardList = mWebView.copyBackForwardList();
String backUrl = webBackForwardList.getItemAtIndex(webBackForwardList.getCurrentIndex() - 1).getUrl();


'android' 카테고리의 다른 글

TextView 선택 복사  (0) 2018.01.19
비트맵 파일로 떨어트리기  (0) 2017.12.14
코드로 원 그리기  (0) 2017.12.11
마테리얼 디자인 정리가 잘되어있어 올립니다.  (0) 2017.12.02
LTE, WIFI, Network 체크  (0) 2017.12.02

ShapeDrawable oval = new ShapeDrawable (new OvalShape());
oval.getPaint().setStyle(Paint.Style.STROKE); // 테두리 선 스타일
oval.getPaint().setStrokeWidth(2); //테두리 선 굵기
oval.getPaint().setAntiAlias(true);
oval.getPaint().setColor(getResources().getColor(R.color.lightGray)); // 색상지정


https://codebeautify.org/

'기타' 카테고리의 다른 글

유니코드 변환  (0) 2020.08.05
쿼리 정리 사이트  (0) 2018.01.31
맥 터미널 개발환경 구축하기  (0) 2017.12.02
나인패치 이미지 사이트  (0) 2017.12.02
폰트 아이콘 사이트  (0) 2017.11.22

https://subicura.com/2017/11/22/mac-os-development-environment-setup.html

'기타' 카테고리의 다른 글

유니코드 변환  (0) 2020.08.05
쿼리 정리 사이트  (0) 2018.01.31
codebeautify  (0) 2017.12.02
나인패치 이미지 사이트  (0) 2017.12.02
폰트 아이콘 사이트  (0) 2017.11.22

http://www.kmshack.kr/2015/01/%EC%95%88%EB%93%9C%EB%A1%9C%EC%9D%B4%EB%93%9C-%EB%A8%B8%ED%8B%B0%EB%A6%AC%EC%96%BC-%EB%94%94%EC%9E%90%EC%9D%B8-%EC%9C%84%EC%A0%AF-%EC%98%A4%ED%94%88%EC%86%8C%EC%8A%A4-21%EA%B0%80%EC%A7%80-2-2/

'android' 카테고리의 다른 글

웹뷰 바로 전의 URL 가져오기  (0) 2017.12.12
코드로 원 그리기  (0) 2017.12.11
LTE, WIFI, Network 체크  (0) 2017.12.02
문자열 숫자 콤마 붙이기  (0) 2017.12.02
문자열 전화번호 포맷  (0) 2017.12.02

http://inloop.github.io/shadow4android/

'기타' 카테고리의 다른 글

유니코드 변환  (0) 2020.08.05
쿼리 정리 사이트  (0) 2018.01.31
codebeautify  (0) 2017.12.02
맥 터미널 개발환경 구축하기  (0) 2017.12.02
폰트 아이콘 사이트  (0) 2017.11.22
public static boolean checkWifi(Context context) {
boolean rtn = false;

ConnectivityManager cm = (ConnectivityManager) context.getSystemService(context.CONNECTIVITY_SERVICE);
NetworkInfo ni = cm.getActiveNetworkInfo();

if(ni != null) {
if(ni.getType() == ConnectivityManager.TYPE_WIFI) {
rtn = ni.isConnected();
}
}

return rtn;
}

public static boolean checkLTE(Context context) {
boolean rtn = false;

ConnectivityManager cm = (ConnectivityManager) context.getSystemService(context.CONNECTIVITY_SERVICE);
NetworkInfo ni = cm.getActiveNetworkInfo();

if(ni != null) {
if(ni.getType() == ConnectivityManager.TYPE_MOBILE) {
rtn = ni.isConnected();
}
}

return rtn;
}

public static boolean checkNetwork(Context context) {
boolean rtn = false;

if(checkLTE(context) || checkWifi(context)) {
rtn = true;
} else {
rtn = false;
}

return rtn;
}


'android' 카테고리의 다른 글

코드로 원 그리기  (0) 2017.12.11
마테리얼 디자인 정리가 잘되어있어 올립니다.  (0) 2017.12.02
문자열 숫자 콤마 붙이기  (0) 2017.12.02
문자열 전화번호 포맷  (0) 2017.12.02
Custom ProgressDialog  (0) 2017.12.02

+ Recent posts