Android :: BitmapFactory.decodeByteArray() Returning NULL

Jul 26, 2010

I am using the previewCallback from the camera to try and grab images. Here is the code I am using

private Camera.PreviewCallback mPrevCallback = new Camera.PreviewCallback()
{
public void onPreviewFrame( byte[] data, Camera Cam ) {
Log.d("CombineTestActivity", "Preview started");
Log.d("CombineTestActivity", "Data length = "
+ data.length );
currentprev = BitmapFactory.decodeByteArray( data, 0,
data.length );....................................

Android :: BitmapFactory.decodeByteArray() returning NULL


Android :: BitmapFactory.decodeByteArray Returns Null

Aug 18, 2010

In my application I am converting base64 string to image.For that I initially converted base 64 file to byte array and later am trying to convert to images.
To convert to Images I am using the below code

File sdImageMainDirectory = new File("/data/data/com.ayansys.Base64trial");
FileOutputStream fileOutputStream = null;
String nameFile="Images";
try {.......................

View 1 Replies View Related

Android :: BitmapFactory.decodeStream Returning Null When Options Set

Mar 23, 2010

I'm having issues with BitmapFactory.decodeStream(inputStream). When using it without options, it will return an image. But when I use it with options as in .decodeStream(inputStream, null, options) it never returns Bitmaps. What I'm trying to do is to downsample a Bitmap before I actually load it to save memory.
I've read some good guides, but none using .decodeStream.........................

View 2 Replies View Related

Android :: OutOfMemoryError At BitmapFactory.decodeByteArray

Jun 9, 2009

I get a OutOfMemoryError at BitmapFactory.decodeByteArray when bitmap size is large; Following is the code snippet:

BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize = 8; Bitmap bitmap = null; bitmap = BitmapFactory.decodeByteArray(data, 0, data.length, options);..........

View 3 Replies View Related

Android :: BitmapFactory.decodeByteArray Gives Pixilated Bitmap

Jan 30, 2010

I am working on an app that displays photos which are downloaded from Flickr. I obtain a Bitmap object from a byte array, which in turn is read from the relevant Flickr URL, as follows: Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length); The problem is that the resulting bitmap is pixelated and I can't figure out why. To demonstrate, here is an example of a picture created via BitmapFactory.decodeByteArray versus the original picture obtained directly from the relevant Flickr URL:...

View 6 Replies View Related

Android :: Bitmap From Camera Preview Using BitmapFactory.decodeByteArray

May 20, 2009

I'm using the Camera.PreviewCallback.onPreviewFrame to try to generate a bitmap from the byte array passed to that method. If I use BitmapFactory.decodByteArray it returns null. I'm assuming that the array is correctly formatted since the data just comes right from the camera, so what could the problem be?

View 9 Replies View Related

Android :: DecodeByteArray With WebService Image Always Null / Solution For This?

Oct 26, 2010

There what I am trying to do :

I am calling a WebService that send me back an image.
I get it from the entity.getContent() method.

Further in my code I try to use de BitmapFactory.decodeByteArray(myImage, 0, myImage.lenght) but the Bitmap that it returns me is always null

Does someone have an idea ?

View 1 Replies View Related

Android :: BitmapFactory.decodeStream Returns Null

Oct 3, 2009

I have an activity which performs an image search, the results (URLs of thumbnails on the web) are rendered in a GridView. My GridView adapter class delegates creating the actual Bitmaps to an AsyncTask that loops to sequentially fetch the image content from each URL using HTTPClient, and creates the Bitmaps using:

BitmapFactory.decodeStream(entity.getContent()).

I found that the above method sometimes returns "null" silently instead of creating a Bitmap. The occurrences appear to correlate with larger stream sizes (I check this by logging entity.getContentLength()). However, if I put a breakpoint just prior to the decodeStream call & then resume immediately every time I hit it (i.e. pause briefly on each iteration), the Bitmaps are created perfectly every time. All the images are quite small (most <10K), so the download & decodeStream happens fairly quickly. There are never more than 10 images processed in one AsyncTask.

View 6 Replies View Related

Android :: BitmapFactory.decodeFile Returns Null Even Image Exists / Why Is So?

Aug 2, 2010

Saving the file code...

The last line gives a null pointer exception, why is BitmapFactory.decodeFile returning null? I can verify that the file is getting saved correctly as I can pull it using adb and see the png displaying properly.

View 1 Replies View Related

Android :: BitmapFactory.decodeStream(inputStream) Always Return Null When Some Bytes Are Wrong

Aug 30, 2010

I'm building an android app and I'm currently having trouble retrieving a bitmap from an URL.

Here is the code I'm using :

CODE:..........

Everything works fine when the picture's write but when some bytes are wrong, result gets null. I think it's basically expectable as it's written this in the doc of BitmapFactory.decodeStream :

If the input stream is null, or cannot be used to decode a bitmap, the function returns null. The stream's position will be where ever it was after the encoded data was read.

The problem is, my wrong picture is well interpreted by my web browser and I can do so on iPhone platform.

Is there a way to sort of ignore those wrong pixels? maybe with the option parameter?

View 1 Replies View Related

Android :: Returning Null Pointer

Oct 5, 2010

The line "return db.insert(DATABASE_TABLE, null, initialValues);" is returning a null pointer and I cant figure out why! I'd be grateful for any help public class Database extends Activity {

@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
DBAdapter db = new DBAdapter(this);
if(db != null){
long id = db.insertUser("test", "test");
Cursor c = db.getUser(id);
Log.d("DB", c.getString(1));
Log.d("DB", c.getString(2)); db.close();.......

View 1 Replies View Related

Android :: ReverseGeocode Is Returning Null In 2.2

Sep 22, 2010

Looks like reverseGeocode ( getFromLocation()) is not working in android 2.2. It is not able to fetch the address from the coordinates. It returns null and crashing my app.

In general 2.2 is not stable - 2.1 was much better. UI response , UI rotation when rotate the phone etc doesn't work reliably....

View 5 Replies View Related

Android :: Returning Data From AsyncTask Resulting In Null Pointer Error

Jul 20, 2010

I am trying to do what I think is a fairly simple task to authenticate a user on my server. I am using AsyncTask as a private subclass of my Activity, however when I try to populate the user object after authenticating it keeps setting it to null. Is there something strange in how the onPostExecute() method is called that is causing this? I originally had the AsyncTask as its own class but ran into the same problem, so I am try to solve this using a private subclass.

View 2 Replies View Related

Android :: OutOfMemoryError From BitmapFactory

Apr 28, 2009

Like many others here I'm getting OutOfMemoryError from BitmapFactory when decoding multiple bitmaps. I am sure I am not leaking memory. Here is the system log from a crash:............

View 23 Replies View Related

Android :: Use BitmapFactory Optimisation

Nov 5, 2010

In my app, I am creating a bitmap from its colors code like this :

CODE:...............

And often I get the outofmemoryerror: So how can I use the BitmapFactory optimisation to avoid this problem? because I don't have an input stream or a file, I only have an array containing my pixels.

View 1 Replies View Related

Android :: BitmapFactory Image From ZipFile

Aug 8, 2009

basically what i'm attempting to do is place several images into 1 zip file, and then read the images back out of the zip file, and draw them onto a canvas using BitmapFactory. This is what my code looks like, but when i debug i only get a source not found error.

Code: try {..............

View 2 Replies View Related

Android :: Image Scaling By BitmapFactory.decodeResource()

Sep 17, 2009

I can't wait to try out the new 1.6 goodies, but first I'm retargeting my existing applications, and I decided to start with Daisy Garden. Changing to android:targetSdkVersion="4" caused the application to segfault on startup and discovered that the BitmapFactory.decodeResource method now performs scaling based on screen density. In this case the behaviour is unwanted - I'm loading a set of masks that are scaled later during composition. So I've quickly inserted the following method, which seems to perfectly mimic the previous behaviour:

private Bitmap loadBitmap(int resId) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inTargetDensity = 1; options.inDensity = 1; return BitmapFactory.decodeResource(context.getResources(), resId, options);
}

View 19 Replies View Related

Android :: BitmapFactory.decodeStream Thread Safe?

May 7, 2010

Is the BitmapFactory.decodeStream method thread safe?

View 2 Replies View Related

Android :: Out Of Memory Error In BitmapFactory.decodeFile

May 22, 2009

I was reading in some other posts that some developers have the same Problem, but till now, no solution. its about the gallery: I have a string array with photos, but when the gallery does show the 2nd Picture it crash with:...............

View 7 Replies View Related

Android :: BitmapFactory.Options - Exceeds VM Budget

Nov 5, 2010

I've been reading about performance issues decoding Bitmaps and have received the OutOfMemoryError "Bitmap exceeds VM budget" issue when I would expect to not be out of memory and read online that this is a common problem referred to as a bug in the framework by many devs. Typically, I get the error mentioned above on my second pass. Let's say I load a somewhat sizable Bitmap successfully and then recycle it and even set the ref to null. When I call this same method a second time that does the work of loading my Bitmap(s) into memory...

I've read on previous posts here and elsewhere online that there are a few things that can be done with BitmapFactory.Options (for instance, providing an input buffer explicitly). But, before proceeding blindly in using what I've found, I'm hoping someone with more knowledge of these classes can shed a little more light...........

View 1 Replies View Related

Android :: Threaded BitmapFactory Image Decoding

Oct 15, 2010

Our Android app does a lot of image decoding. We fetch a lot of images from the internet, local storage caches, etc. Up to now, these images are being decoded on the UI thread (using BitmapFactory.decodeX() methods). It's been causing some timeout crashes because the UI doesn't respond quickly enough to user input.

I could write a little AsyncTask that encapsulates decoding, but I'm not sure that's a good idea. Spawning threads is expensive, and that would be spawning and tearing down a ton of them. So what's the best way to put this on another thread? Do I need to go to the extent of writing a Service? That seems a little heavy-weight. Are there any solutions for this already out there?

View 2 Replies View Related

Android :: BitmapFactory: Decoder - Decode Returned False

Oct 27, 2009

For my current application I collect images from different "event providers" in Spain.

However, when downloading images from salir.com I get the following logcat output: 13970 Gallery_Activity

I Fetching image 2/8 URL: http://media.salir.com/_images_/verticales/a/0/1/0/2540-los_inmortale... 13970 ServiceHttpRequest

I Image [url] fetched in [146ms] 13970 skia D --- decoder->decode returned false

Searching for that error message didn't provide much useful results.

View 4 Replies View Related

Android :: InPurgeable Doesn't Work With BitmapFactory.decodeFile?

Apr 16, 2010

why when I load images from files using BitmapFactory.decodeFile and passing in a BitmapFactory.Options with inPurgeable set to true, I still get OutOfMemoryError? For example, doing the following many times, with lots of different resources works fine:

BitmapFactory.Options opts = new Options() opts.inPurgeable = true; bitmap = BitmapFactory.decodeResource(resources, resId, opts);

However, doing the following causes an OutOfMemoryError

BitmapFactory.Options opts = new Options() opts.inPurgeable = true; bitmap = BitmapFactory.decodeFile(myFile, opts);

In reality my code isn't as simple as outlined above. What I'm really trying to do is load a couple of bitmap resources draw them on a bitmap backed canvas, and then write this new bitmap to file, just so it can then be finally re-read into memory with the inPurgeable option set to true (using BitmapFactory.decodeFile).

View 2 Replies View Related

Android :: Cannot Decode Images From Sd Card Using BitmapFactory.Options

Jun 19, 2009

I am tring to get a image from the images stored on the sdcard of my Android but i am getting a skia error using BitmapFactory When I just take the image directly without using BitmapFactory class I get the image. But the purpose of using BitmapFactory is scaling down the image size by using inSample =4;

but I get skia as the error..................

View 3 Replies View Related

Android :: Use BitmapFactory.decodeStream To Specify Size Of Output Bitmap?

Jul 8, 2009

I have the following code which I tried to build a Bitmap from an input stream and I want my output bitmap to be 20 x 20:

BitmapFactory.Options opts = new BitmapFactory.Options(); opts.outHeight = 20; opts.outWidth = 20;
InputStream stream = // an input stream to my image Bitmap bm = BitmapFactory.decodeStream(stream, null, opts);

But when I tried it, I do get a bitmap from the inputstream, but it does not scale it to 20x20 which I specified in the BitmapFactory.Options.

View 2 Replies View Related

Android :: BitmapFactory.decode And Exit Data In Images

Oct 19, 2010

I'm downsampling an image via BitmapFactory.decode then base64 encoding the bytes to ship to the server. (long story on the latter part of that formula) It seems this process nukes all Exif data in the image data. Am I approaching this the wrong way or is this a fact of life?

View 2 Replies View Related

Android :: Reduce Heap Size To Get Space For BitmapFactory.decodeFile

Nov 16, 2010

I learned from several discussions of this group that BitmapFactory.decodeFile() allocates heap memory outside of the "java heap". My app receives encrypted files from a remote server. Decoding those files needs a lot of heap space. After finishing this decoding step most of the allocated heap space will be freed by the GC. But the (total) heap size - as displayed by the DDM - remains large. In this situation there is not enough heap space outside of the "Java heap" to decode even medium sized image files using BitmapFactory.decodeFile(). At the moment I limit the size of encrypted files to ensure that the Java heap space never increases to more than 10 MB. This ensures that there is enough memory for BitmapFactory.decodeFile(). But this is not very elegant.

Is it possible to tell the dalvik-vm to reduce the (total) heap size to have more space for decoding images or is there another solution?

View 6 Replies View Related

Android : Maximum Size That VM Allocate For Loading A Image With BitmapFactory?

Mar 1, 2010

Some of you may met the same problem, I was using BitmapFactory.decodeStream, and got this exception: Code...

I know the reason is because the BitmapFactory is trying to decode an uncompressed version of a big image(in my situation, jpg). I can use BitmapFactory.Options.inSampleSize to fix it. but my question is what's the maximum size that VM would like to allocate for loading a image with BitmapFactory? so I can do some scale before it loads.

View 2 Replies View Related

Android :: Returning Value From TabActivity

Oct 1, 2009

How can I return a value from TabActivity? It seems that the return value from tab pages vanishes and the caller always receives RESULT_CANCELED instead of RESULT_OK.

View 3 Replies View Related

Android :: Geocoder Not Returning Result

May 8, 2009

My application that uses geocoding was working fine till last week and now all of a sudden am not getting proper data from the same.

I used getLocality() , which was returning CITY name previously. But now it is returning NULL.

Is something changed? or Has someone faced the same issue?

My application is on SDK 1.0

View 12 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved