I have a class that performs optical character recognition on images and extract out the text.
For example:
- ClassA: Performs OCR and sends extracted text to ClassB
- ClassB: Receive extracted text from ClassA and output the results in EditText
However, now I want to add another process to this system:
- ClassA: Performs OCR and sends extracted text to ClassC
- ClassC: Receive extracted text from ClassA and perform a 2nd process to extract out more specific text; then sends to ClassB
- ClassB: Receive extracted text from ClassC and output the results in EditText
However, I am unable to successfully send an intent from ClassA to ClassC.
The problem is not how ClassA send the intent, but how ClassC will receive the intent as the receiving method is quite complicated
Let's say the method in ClassC to do the 2nd process is "EmailValidator()", how do I edit the codes in ClassC so that is would receive the extracted text from ClassA?
Below is the codes in ClassB as of how it currently receive the extracted text from ClassA:
public class CreateContactActivityOCR1 extends Activity {
private String recognizedText, textToUse;
private EditText mEditText1;
private String mFromLang, mCurrentLang;
private void setupUI(){
// Setting up the textbox
mEditText1 = (EditText)findViewById(R.id.EmailET);
mEditText1.setText(textToUse);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_createcontact);
// Getting the path of the image to show
Bundle extras = this.getIntent().getExtras();
recognizedText = extras.getString("TEXT");
textToUse = recognizedText;
// Getting the language used for text recognition
mFromLang = extras.getString("LANG");
mCurrentLang = mFromLang;
//Log.i(TAG, mFromLang);
setupUI();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
textToUse = mEditText1.getText().toString();
super.onConfigurationChanged(newConfig);
setContentView(R.layout.usetext);
setupUI();
//Log.i(TAG, "onConfigChanged");
}
}
Note that it is able to receive the text from ClassA and display in EditText. What I want to achieve now is to pass this extracted text(known as recognizedText in the codes) into the method "EmailValidator()" in ClassC.
So how should ClassC receive the extracted text from ClassA, by manipulating the receiving method from ClassB?