Skip to main content

image view  convert  to Bitmap and bitmap convert to byte[]image

image view  convert  to Bitmap

BitmapDrawable bitmapDrawable= (BitmapDrawable) imageView.getDrawable();
Bitmap bitmap=bitmapDrawable.getBitmap();

Bitmap convert to a byte array(byte[]image)

private byte[] imagaetobyte(Bitmap bitmap) {

ByteArrayOutputStream byteArrayOutputStream=new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG,90,byteArrayOutputStream);
byte[]image=byteArrayOutputStream.toByteArray();
return image;


}

byte[] convert to bitmap set in imageview 
Bitmap bitmap= BitmapFactory.decodeByteArray(reconizeimage,0,reconizeimage.length);
holder.imageview.setImageBitmap(bitmap);




Comments

Popular posts from this blog

 var val  deference in kotlin  fun main () { var Android_Programing_language : String = "java" println ( "android official programing language: " + Android_Programing_language ) Android_Programing_language = "Kotline" println ( "2019 google announced android official programing language: " + Android_Programing_language ) val Android_MultiPlatform_language : String = "Dart" println ( "multiple device run : " + Android_MultiPlatform_language ) /* Android_MultiPlatform_language="" /* note: var--------------valu changable note: val--------------valu not changable (final) */ */ }
 phone authentication in android using Firebase Step 1:    Add Firebase to your Android project Step 2: Add this line build.Gradle(project) // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() jcenter() } dependencies { classpath "com.android.tools.build:gradle:4.1.1" classpath 'com.google.gms:google-services:4.3.5' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { google() jcenter() } } task clean( type : Delete) { delete rootProject . buildDir } Step 3: Add this dependency build.Gradle (app level) plugins { id 'com.android.application' } android { compileSdkVersion 30 buildToolsVersion "30.0.3" defaultConfig { applicationId "com.ruhul.firebasephone...
  Android  Location Permissions With  GPS  disabled Enable Hello Everyone, In this Tutorial I Will Show you how Can I Get Android Location Permission Granted. In Case There is a Common Problemes When User Allow Permission Granted but not Gps Enable. So how Can I Solve This Problemes Flow this Step Step 1: AndroidManifest.xml  file  Permission add <uses-permission android :name ="android.permission.INTERNET" /> <uses-permission android :name ="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android :name ="android.permission.ACCESS_BACKGROUND_LOCATION" /> Step 2: Android XML Design Simple Button like  <? xml version ="1.0" encoding ="utf-8" ?> <RelativeLayout xmlns: android ="http://schemas.android.com/apk/res/android" xmlns: app ="http://schemas.android.com/apk/res-auto" xmlns: tools ="http://schemas.android.com/tools" android :layout_width ="match_pa...