Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- m_galleryIntent = new Intent();
- m_galleryIntent.setType("image/*");
- m_galleryIntent.setAction(Intent.ACTION_GET_CONTENT);
- m_profileButton.setOnClickListener(new OnClickListener()
- {
- public void onClick(View v)
- {
- startActivityForResult(Intent.createChooser(m_galleryIntent, "Select Picture"),1);
- }
- });
- Bitmap yourBitmap;
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- yourBitmap.compress(Bitmap.CompressFormat.PNG, 100, bos);
- byte[] bArray = bos.toByteArray();
- public static byte[] getBytesFromBitmap(Bitmap bitmap) {
- if (bitmap!=null) {
- ByteArrayOutputStream stream = new ByteArrayOutputStream();
- bitmap.compress(Bitmap.CompressFormat.JPEG, 70, stream);
- return stream.toByteArray();
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement