Access pictures from Pictures app in my android app

You can usestartActivityForResult, passing in an Intent that describes an action you want completed and and data source to perform the action on. Luckily for you, Android includes an Action for picking things: Intent.ACTION__PICK and a data source containing pictures: android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI for images on the local device or android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI for images on the SD card. … Read more

Android make animated video from list of images

Android do not support for AWT’s BufferedBitmap nor AWTUtil, that is for Java SE. Currently the solution with SequenceEncoder has been integrated into jcodec’s Android version. You can use it from package org.jcodec.api.SequenceEncoder. Here is the solution for generating MP4 file from series of Bitmaps using jcodec: try { File file = this.GetSDPathToFile(“”, “output.mp4”); SequenceEncoder … Read more

How to change the Tabs Images in the TabHost

If you wish to use different images for the selected and unselected states, then create ‘selector’ XML files in your drawables folder for each tab, e.g. tab1_selector.xml, tab2_selector.xml which should contain the following, replacing the drawable references to your images for selected and unselected states. i.e. <?xml version=”1.0″ encoding=”utf-8″?> <selector xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:state_selected=”true” android:drawable=”@drawable/tab1_selected_image” /> … Read more

Convert bitmap array to YUV (YCbCr NV21)

Here is some code that actually works: // untested function byte [] getNV21(int inputWidth, int inputHeight, Bitmap scaled) { int [] argb = new int[inputWidth * inputHeight]; scaled.getPixels(argb, 0, inputWidth, 0, 0, inputWidth, inputHeight); byte [] yuv = new byte[inputWidth*inputHeight*3/2]; encodeYUV420SP(yuv, argb, inputWidth, inputHeight); scaled.recycle(); return yuv; } void encodeYUV420SP(byte[] yuv420sp, int[] argb, int width, … Read more

Bitmap recycle with largeHeap enabled

You should probably have a look at Displaying Bitmaps Efficiently which includes several ways to handle large Bitmaps Efficiently, Loading Large Bitmaps Efficiently BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeResource(getResources(), R.id.myimage, options); int imageHeight = options.outHeight; int imageWidth = options.outWidth; This will give you the size of the image before downloading and on … Read more

Reading an image file into bitmap from sdcard, why am I getting a NullPointerException?

The MediaStore API is probably throwing away the alpha channel (i.e. decoding to RGB565). If you have a file path, just use BitmapFactory directly, but tell it to use a format that preserves alpha: BitmapFactory.Options options = new BitmapFactory.Options(); options.inPreferredConfig = Bitmap.Config.ARGB_8888; Bitmap bitmap = BitmapFactory.decodeFile(photoPath, options); selected_photo.setImageBitmap(bitmap); or http://mihaifonoage.blogspot.com/2009/09/displaying-images-from-sd-card-in.html

How to create a circular ImageView in Android? [duplicate]

I too needed a rounded ImageView, I used the below code, you can modify it accordingly: import android.content.Context; import android.graphics.Bitmap; import android.graphics.Bitmap.Config; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.PorterDuff.Mode; import android.graphics.PorterDuffXfermode; import android.graphics.Rect; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.widget.ImageView; public class RoundedImageView extends ImageView { public RoundedImageView(Context context) { super(context); } public … Read more