Note that there are some explanatory texts on larger screens.

plurals
  1. POFinish an activity,get string typed result from a class and use that result to another activity
    primarykey
    data
    text
    <p>I'm new in android environment and started a Software development project, so my knowledge is too few in it. I need help in detail.</p> <p>Problem details: </p> <p>Project is on ANDROID OCR code source from github Robert m.theis</p> <p>currently it's outcome is - while i take an image of any written text,it retrieves quite exact output using tesseract engine as text and search in internet.</p> <p>my work is - use the text string (digits ) and call to a phone operator. my project name is automated mobile card recharging system.</p> <p>so that i took result text from a method getText() class named OcrResult.java and put into my own activity. But i don't know why this don't working in real device.</p> <p>it builds, run in emulator, but in real device at least it should show messages! But it doesn't.</p> <p>i also added in manifest.xml file as (angel braces are remover here) under activity activity android:name="edu.sfsu.cs.orange.ocr.call.CallManager" </p> <p>under application uses-permission android:name="android.permission.CALL_PHONE"</p> <p>here my code is</p> <pre><code>package edu.sfsu.cs.orange.ocr.call; import edu.sfsu.cs.orange.ocr.OcrResult; import edu.sfsu.cs.orange.ocr.CaptureActivity; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.KeyEvent; import android.view.SurfaceHolder; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.Toast; public class CallManager extends Activity { public static final String preString = "*111*"; public static final String postString = "#"; //to store retrieved digits String finalString; //to get text result from ocr result OcrResult getStringResult = new OcrResult(); String middleString = getStringResult.getText(); //if it fails to scan desired digit,call the process again CaptureActivity tryProcessAgain = new CaptureActivity(); public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } public void setString(String x) { middleString = x; } public String getString( String toBeInserted) { if(toBeInserted.length() == 16) { int counter = 0; char [] insertHere = new char[16]; for(int verifier = 0; verifier &lt; 16; verifier ++) { insertHere[verifier] = toBeInserted.charAt(verifier); if(!Character.isDigit(insertHere[verifier])) { break; } counter ++; } if(counter == 16) { finalString = preString + toBeInserted + postString; return finalString; } else { // @SuppressWarnings("unused") //Toast toast = Toast.makeText(this, " number scan invalid.....OCR failed. Please try again.", Toast.LENGTH_SHORT); //toast.show(); return middleString; } } else { //@SuppressWarnings("unused") //Toast toast = Toast.makeText(this, " number scannin invalid...OCR failed. Please try again.", Toast.LENGTH_SHORT); //toast.show(); return middleString; } } public void CallToOperator(String callMe) { Toast toast = Toast.makeText(this,finalString,Toast.LENGTH_SHORT); toast.show(); //Toast toast1 = Toast.makeText(this,middleString,Toast.LENGTH_SHORT); //toast1.show(); if(callMe == finalString) { try { startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + finalString))); } catch (Exception e) { e.printStackTrace(); } } else { tryProcessAgain.onShutterButtonPressContinuous(); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload