Parse data from scanned image

 

Sometimes, Scanning the files can be core requirements of Android platform.Scanning of files involves reading the data from a file, processing the data for some other purposes, perform operations on data, It can useful for other useful operations also like to send emails, to send a message, to make calls if the data contains emails, phone etc.

The article is based on reading the excel file which contains contact no of people and to make calls with just single click.Follow the below steps to perform the same.

  1. First Download the Apache POI – Java API To Access Microsoft Format Files from the following URL

http://grepcode.com/snapshot/repo1.maven.org/maven2/org.apache.poi/poi/3.7

  1. Copy-paste the jar file into the libs directory of the project folder.
  1. Add the dependencies into build.gradle to compile copied jar file.

  1. Access the file using the following code

  1. Convert the excel file into HSSFSheet for next processing

    6.Read values from each row and each cell using the following code

 

ExcelData class and CellValueObject class are as  follows

 

 

  1. Now, these data can be arranged into listview of Layout with the help of Custom Adapter (Which extends BaseAdapter) of ListView and on Item Click, any type of events( like phone call, email, message if excel contains phone no/email etc.) can be achieved according to requirement.

 

Comments