java - Android use and intent values from AsyncTask.execute(new Runnable() -


i ask, how use , intent values asynctask.

this on top: (this values use)

double confidence; string platenumbertest; 

this actual asynctask

asynctask.execute(new runnable() {                 @override                 public void run() {                     string result = openalpr.factory.create(index.this, android_data_dir).recognizewithcountryregionnconfig("eu", "", destination.getabsolutepath(), openalprconffile, 10);                      log.d("open alpr", result);                      try {                         final results results = new gson().fromjson(result, results.class);                         runonuithread(new runnable() {                             @override                             public void run() {                                 if (results == null || results.getresults() == null || results.getresults().size() == 0) {                                     toast.maketext(index.this, r.string.notdetecttoast, toast.length_long).show();                                     resulttextview.settext(r.string.notdetect);                                 } else {                                     resulttextview.settext(string.format("plate: %s confidence: %s%% processing time: %s seconds", results.getresults().get(0).getplate(), string.format("%.2f", results.getresults().get(0).getconfidence()), string.format("%.2f", ((results.getprocessing_time_ms() / 1000.0) % 60))));                                      edittext = (edittext) findviewbyid(r.id.edit_text);                                     edittext.settext(results.getresults().get(0).getplate(), textview.buffertype.editable);                                      confidence = results.getresults().get(0).getconfidence();                                     platenumbertest = results.getresults().get(0).getplate();                                  }                             }                           }); 

i trying demonstrate in example, it's return null

this intent, on setonclicklistener button:

intent intent = new intent(index.this, dvlaresult.class);                 bundle extras = new bundle();                  extras.putstring("confidenceresult", string.valueof(confidence));                 extras.putstring("platenumberresult", platenumbertest);                  intent.putextras(extras);                  startactivity(intent); 

p.s. sorry question in duplicated somewhere, can't figure out example.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -