I have the following problem and I don't know how to pass it. I searched for an answer but none had this problem. I have the following:
public class RomanianIDFrontSideRecognitionResultExtractor extends MrtdResultExtractor<RomaniaIdFrontRecognizer.Result, RomaniaIdFrontRecognizer> {
static String nume;
static String prenume;
static String nr;
static String serie;
static String cnp;
static String nat;
static String locn;
static String adresa;
static String emis;
static String sex;
static String start;
static String stop;
static String usern;
private Context mContext;
static String a;
static Toast toast;
@SuppressLint("InlinedApi")
@Override
protected void extractData(RomaniaIdFrontRecognizer.Result result) {
super.extractData(result);
add(R.string.PPLastName, result.getLastName());
add(R.string.PPFirstName, result.getFirstName());
add(R.string.PPIdentityCardNumber, result.getCardNumber());
add(R.string.PPSeries, result.getIdSeries());
add(R.string.PPCNP, result.getCnp());
add(R.string.PPNationality, result.getNonMRZNationality());
add(R.string.PPPlaceOfBirth, result.getPlaceOfBirth());
add(R.string.PPAddress, result.getAddress());
add(R.string.PPIssuingAuthority, result.getIssuedBy());
add(R.string.PPSex, result.getNonMRZSex());
add(R.string.PPValidFrom, result.getValidFrom());
add(R.string.PPValidUntil, result.getValidUntil());
// Toast.makeText(getApplicationContext(),result.getLastName() ,
// Toast.LENGTH_SHORT).show();
// Intent myIntent = new Intent(getApplicationContext(), ResultActivity.class);
// getApplicationContext().startActivity(myIntent);
SharedPreferences pref = getApplicationContext().getSharedPreferences("MyPref", 0); // 0 - for private mode
SharedPreferences.Editor editor = pref.edit();
SharedPreferences pref2 = getApplicationContext().getSharedPreferences("MyPreff", 0);
usern= pref2.getString("username", null);
editor.putString("nume", result.getLastName());
editor.putString("prenume", result.getFirstName());
editor.putString("nr", result.getCardNumber());
editor.putString("serie", result.getIdSeries());
editor.putString("cnp", result.getCnp());
editor.putString("nationalitate", result.getNonMRZNationality());
editor.putString("locn", result.getPlaceOfBirth());
editor.putString("adresa", result.getAddress());
editor.putString("emis", result.getIssuedBy());
editor.putString("sex", result.getNonMRZSex());
editor.putString("start", String.valueOf(result.getValidFrom()));
editor.putString("sfarsit", String.valueOf(result.getValidUntil()));// Storing string
editor.commit(); // commit changes
}
This part of code worked ok. I could send the variables from this activity to another one. But yesterday, the getApplicationContext() is not working anymore. Yesterday appeared to me that is deprecated and I,by mistake, hit ignore this warning. And now, the variables aren't sent anymore because of that. I just receive empty variables. How can I bypass and make getApplicationContext() work again? In other files works ok, only in this file isn't working. And it appears as being italic writing. Have you seen this kind of behaviour?