Learn Android for Free,issues for developers, mobengineers website provide complete solutions for developers issues posts.It also provides online training for android development

Thursday, April 23, 2015

Bitmap to ByteArray Android

public static byte[] convertBitmapToByteArray(Bitmap bitmap) {
if (bitmap == null) {
return null;
} 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;
}

}

Wednesday, April 22, 2015

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.

Sunday, April 19, 2015

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, 

android:debuggable="true"


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

Thursday, April 16, 2015

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.












Wednesday, April 15, 2015

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*)

!!! FAILED BINDER TRANSACTION !!!

 !!! FAILED BINDER TRANSACTION !!!


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.





Friday, April 10, 2015

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(TestJNIActivity.java:18)
04-10 14:49:35.505: E/AndroidRuntime(14206): at android.app.Activity.performCreate(Activity.java:5275)
04-10 14:49:35.505: E/AndroidRuntime(14206): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)




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


TestJNIActivity.java

package com.permadi.testjni;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;

public class TestJNIActivity extends ActionBarActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test_jni);


TextView myTextField = (TextView)findViewById(R.id.myTextField);
       myTextField.setText(stringFromJNICPP());
}


public native String  stringFromJNICPP();

static {
        System.loadLibrary("TestJNI");
    }

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

@Override
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
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}




TestJNI.cpp

#include <string.h>
#include <jni.h>
#include <android/log.h>

 extern "C" {
     JNIEXPORT jstring JNICALL Java_com_permadi_testjni_TestJNIActivity_stringFromJNICPP(JNIEnv * env, jobject obj);
 };

 JNIEXPORT jstring JNICALL Java_com_permadi_testjni_TestJNIActivity_stringFromJNICPP(JNIEnv * env, jobject obj)
 {
return env->NewStringUTF("Hello World");
 }

20% off

Online Training

Your Name :
Your Email: (required)
Your Message: (required)

NDTV Gadgets360

Powered by Blogger.

Recent Posts

Find Us On Facebook

Popular Posts