Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - how to convert bitmap to byte array in android

how to convert bitmap to byte array in android

Tutorials with advanced 'difficulty' and more Lines of Code.

how to convert bitmap to byte array in android

Postby narasimharao » Mon Apr 12, 2010 12:50 pm

hi all
i am new in android i am implementing image retrieve in sdcard in image convert into bitmap and in bitmap convert in to byte array please forward some solution of this code
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageView image = (ImageView) findViewById(R.id.picview);
EditText value=(EditText)findViewById(R.id.EditText01);
FileInputStream in;
BufferedInputStream buf;
try {
in = new FileInputStream("/sdcard/pictures/1.jpg");
buf = new BufferedInputStream(in,1070);
System.out.println("1.................."+buf);
byte[] bMapArray= new byte[buf.available()];
buf.read(bMapArray);
Bitmap bMap = BitmapFactory.decodeByteArray(bMapArray, 0, bMapArray.length);
for (int i = 0; i < bMapArray.length; i++) {
System.out.print("bytearray"+bMapArray[i]);
}
image.setImageBitmap(bMap);
value.setText(bMapArray.toString());
if (in != null) {
in.close();
}
if (buf != null) {
buf.close();
}

} catch (Exception e) {
Log.e("Error reading file", e.toString());
}
}

}
solution is

04-12 16:41:16.168: INFO/System.out(728): 4......................[B@435a2908 this is the result for byte array not display total byte array this array size is 1034 please forward some solution
narasimharao
Junior Developer
Junior Developer
 
Posts: 11
Joined: Mon Apr 05, 2010 12:40 pm
Location: hyderabad

Top

Re: how to convert bitmap to byte array in android

Postby sunkillen » Thu May 20, 2010 8:51 am

Hi,
Hope it could help you.

ByteArrayOutputStream bos = new ByteArrayOutputStream();
bitmap.compress(CompressFormat.PNG, 0 /*ignored for PNG*/, bos);
byte[] bitmapdata = bos.toByteArray();
sunkillen
Freshman
Freshman
 
Posts: 3
Joined: Tue Jun 24, 2008 8:58 am

Re: how to convert bitmap to byte array in android

Postby narasimharao » Thu May 20, 2010 11:44 am

thank you very much
narasimharao
Junior Developer
Junior Developer
 
Posts: 11
Joined: Mon Apr 05, 2010 12:40 pm
Location: hyderabad

Re: how to convert bitmap to byte array in android

Postby misu_cosma@yahoo.com » Mon Jun 20, 2011 6:07 pm

How can u do the reverse process,I mean from bytearray to bitmap?
misu_cosma@yahoo.com
Freshman
Freshman
 
Posts: 7
Joined: Mon May 09, 2011 11:03 am

Re: how to convert bitmap to byte array in android

Postby inmyth » Tue Jul 12, 2011 6:32 pm

//if bitmapdata is the byte array then getting bitmap goes like this
Bitmap bitmap = BitmapFactory.decodeByteArray(bitmapdata , 0, bitmapdata .length);
inmyth
Freshman
Freshman
 
Posts: 7
Joined: Sat Oct 30, 2010 6:44 am

Re: how to convert bitmap to byte array in android

Postby edeferaxy » Fri Jan 20, 2012 11:43 am

How do I get my computer to display bitmap images as my wallpaper? As of right now I can't get my computer to display any bitmap image as a wallpaper on my computer. I can only get it to display JPEG images as my wallpaper. I have run registry repair pro and it still did not fix this problem. Thanks.
_____________________________________
keyword research ~ keyword tool ~ keyword tracking ~ affiliate elite
edeferaxy
Freshman
Freshman
 
Posts: 3
Joined: Fri Jan 20, 2012 6:43 am

Top

Return to Advanced Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest