Android Barcode Detection from Fast Moving Objects

Assume you apply barcode technology to the logistics conveyor belt for scanning parcels. A problem you may face is how to recognize barcodes from blurred images. Although we can use advanced algorithms to deal with this complicated case, we’d better improve the image quality as possible as we can. A simple way is to adjust the camera shutter speed which is also known as exposure time. Faster shutter speed can avoid motion blur. In this post, I will share how to invoke Android Camera2 APIs to change the shutter speed, as well as how to build a simple Android barcode reader to decode barcodes from fast-moving objects

Read more

Android Camera Preview App: Camera vs. Camera2

Building Android camera apps is much more complicated than building iOS camera apps due to the different vendors and hardware specs. Since from API level 21, the old Camera class was deprecated and a brand-new Camera2 class was born. In this post, I want to use the least code to create Android camera preview apps with Camera and Camera2 respectively and compare the usage difference between the two sets of APIs.

Read more

How to Export and Import Java Documentation in Android Studio

When creating an Android library for distribution, besides the class package, source code and documentation are also needed in order to assist developers. Although Eclipse is convenient that you just need to right-click on the project and choose export to generate Javadoc and JAR file, more and more Android developer gets started to use Android Studio instead of Eclipse ADT. In this tutorial, l will show you how to pack and attach Java documentation and source code in Android Studio from scratch.

Read more

How to Monitor USB Events on Android

Comparing to iOS, one of my favorite Android features is that Android supports USB peripherals. It’s fairly convenient to connect USB devices to Android smartphones via OTG cables. Therefore, no matter whether your Android phones, which probably only have 16G built-in storage, have SD card slot or not, it’s still capable of extending storage spaces with the power of accessing USB flash drive on Android operating system. In this post, I’d like to share what I’ve learned from Android developer website about how to monitor the events of attaching and detaching USB devices.

Read more

How to Push Notifications to Android Applications from Windows

When you are scanning tons of documents with your scanner applications, probably you don’t have enough time to take a break sometimes. Because you need to stare at the screen for checking all scanning information in case of some errors. Fortunately, mobile applications can help us reduce the burden. No matter where we are, using a smartphone as the monitor is a convenient way to deal with some emergencies. In this tutorial, I’d like to share how to create an Android application for receiving notifications from a .NET scanner application which is implemented based on Dynamic .NET TWAIN.

Read more

Wireless TWAIN Document Scanning on Android

If you have a TWAIN-compliant scanner, you can easily control it with Dynamic Web TWAIN or Dynamic .NET TWAIN. Both SDKs can help you create some excellent applications for document scanning and management on PCs. However, have you ever complained that it’s so inconvenient to stay with your scanners and PCs all the time? Since mobile technology is so hot today, why don’t you make TWAIN scan wireless, getting rid of clumsy machines? In this tutorial, I’d like to show you how to create a simple Android application and a .Net TWAIN server to conveniently capture document images from remote TWAIN scanners to your smartphone.

Read more

Getting Started with JNI on Android, Windows and Mac

Java Native Interface (JNI) is the glue between Java and native code such as C, C++, and assembly. With JNI, Java applications are capable of supporting platform-specific features. JNI enables developers to call low-level APIs (e.g. SQL, OpenGL etc.) to make Java application more powerful with higher performance. For example, we can download a JDBC driver, and unzip the jar package to take an insight. The driver is not written in pure Java. It also contains native libraries for Linux, Mac, and Windows.

jdbc

Since JNI is so useful, I’d like to share how to get started with JNI on Android, Windows, and Mac.

JNI on Android

Download NDK and configure the location in Eclipse:

android JNI

Create a new project named hellojni. To automatically generate the native C/C++ code and configuration file, you just need to right-click on your project and select Add Native Support:

add_native_support

After that, a JNI project will be automatically generated. To build the shared library, you just need to implement JNI methods in C/C++, and add configurations in Android.mk.

jni_folder

When you save all changes, the shared library libhellojni.so will be automatically generated. You can also build the library by typing in ndk-build.ndk_build

JNI on Windows

Create a Win32 project named hellojni in Visual Studio:

Read more