Showing posts from April, 2015

Bitmap to ByteArray Android

publicstaticbyte[] convertBitmapToByteArray(Bitmap bitmap) { if (bitmap == null) { returnnull; } else { byte[] b = null; try { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); bitmap.compress(CompressFormat.PNG, 0, byteArrayOutputStream); b = byteArrayOutputStream.toByteArray(); } catch (Exception e) { e.printStackTrace(); } return b; }

ARC forbids explicit message send of 'release'

ARC forbids explicit message send of 'release'

ARC is an automatic reference counting. Here no need to release memory manually, ARC will release automatically.

Its a compiler feature that , it uses automatic memory management of objective c objects.

Error in manifest android:debuggable="true"

Avoid hardcoding the debug mode; leaving it out allows debug and release builds to automatically assign   one

I added this for android manifest, 

I got solved by cleaning the project. Now i am able to debug.

Image Processing

What is an image ?

Image is collection of pixels.

Types of images:

1. Grey scale image
2. Binary Image
3. Coloured Image

Image Processing is image and processing.

 Applying the image modification techniques like converting into grey scale image, detecting the pixel density etc..

OpenCv tutorial

Open Source Computer Vision (OpenCV)  -  Four Modules are there.

CV - Main OpenCV functions, image processing and vision algorithms.

CVAUX  - Experimental OpenCv functions.

CXCORE -Data structure support and other algorithms.

HIGHGUI : Graphical User Interface functions , image and video.

Fatal signal 11 (SIGSEGV) at 0x3b0dcef0 (code=1)

Fatal signal 11 (SIGSEGV) at 0x3b0dcef0 (code=1), thread 973
 Send stop signal to pid:973 in void debuggerd_signal_handler(int, siginfo_t*, void*)



I got this issue while transferring large bitmap data.

intent.putExtra("imagedata", data);
To resolve this issue, avoid transferring of large bitmaps.
The binder transaction failed due to large size.During remote procedure call, arguments and the returned value of call transferred as Parcel objects stored under the binder transaction buffer. If the returned value or arguments too large to fit in the transaction butter, the call will get fail and TransactionTooLargeException will be thrown.

java.lang.UnsatisfiedLinkError Android NDK

04-10 14:49:35.505: E/AndroidRuntime(14206): java.lang.UnsatisfiedLinkError: Native method not found: com.permadi.testjni.TestJNIActivity.stringFromJNICPP:()Ljava/lang/String;
04-10 14:49:35.505: E/AndroidRuntime(14206): at com.permadi.testjni.TestJNIActivity.stringFromJNICPP(Native Method)
04-10 14:49:35.505: E/AndroidRuntime(14206): at com.permadi.testjni.TestJNIActivity.onCreate(
04-10 14:49:35.505: E/AndroidRuntime(14206): at
04-10 14:49:35.505: E/AndroidRuntime(14206): at

Solution: please check the package name and method name for an activity. I got this issue due to case sensitive in cpp file for package name or method name.

Android NDK Hello World

package com.permadi.testjni;

import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;

public class TestJNIActivity extends ActionBarActivity {

protected void onCreate(Bundle savedInstanceState) {

TextView myTextField = (TextView)findViewById(;

public native String  stringFromJNICPP();

static {

public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(, menu);
return true;

public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long