Category: Code Snippets

Make Bitmap instance from Drawable 0

Make Bitmap instance from Drawable

[code lang=”java”] // Create empty bitmap Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); // Create canvas to draw drawable Canvas canvas = new Canvas(bitmap); // Set bounds d.setBounds(0, 0, 48, 48); // Draw drawable to...

Get App Installed Date on Android 0

Get App Installed Date on Android

API Level 9 이전 버전 [code lang=”java”] PackageManager pm = context.getPackageManager(); ApplicationInfo appInfo = pm.getApplicationInfo("app.package.name", 0); String appFile = appInfo.sourceDir; long installed = new File(appFile).lastModified(); [/code] API Level 9 이상 [code lang=”java”] long installed...

Get current language in device 0

Get current language in device

Store image to file 0

Store image to file

[code lang=”java”] public static boolean StoreByteImage(Context mContext, byte[] imageData, int quality, String expName) {

[/code]

[Android] Get image from gallery 4

[Android] Get image from gallery

개요 앨범에서 이미지를 선택하도록 액티비티를 호출하고 onActivityResult() 함수를 통해 해당 이미지에 접근하는 소스 앨범 호출 소스 [code lang=”java”] Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null); intent.setType("image/*"); startActivityForResult(intent, 1004); [/code] 선택된 이미지 가져오기 소스 [code lang=”java”]...