private final WorkerRunnable<Params, Result> mWorker;
private static abstract class WorkerRunnable<Params, Result> implements Callable<Result> {
Params[] mParams;
}
Я беру красную линию в mWorker = new WorkerRunnable<Params, Result>()
строке. Это java собственный класс. Я не понимаю, как я могу принять ошибку. Пожалуйста, помогите мне.
public AsyncTask(Looper callbackLooper) {
mHandler = callbackLooper == null || callbackLooper == Looper.getMainLooper()
? getMainHandler()
: new Handler(callbackLooper);
mWorker = new WorkerRunnable<Params, Result>() {
public Result call() throws Exception {
mTaskInvoked.set(true);
Result result = null;
try {
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
//noinspection unchecked
result = doInBackground(mParams);
Binder.flushPendingCommands();
} catch (Throwable tr) {
mCancelled.set(true);
throw tr;
} finally {
postResult(result);
}
return result;
}
};
Я звонил выполнить в методе oncreate () вот так
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_solution);
resultt = findViewById(R.id.recognizeResult2);
resultview = findViewById(R.id.textView);
new WolframFeed().execute();
}
и я использую AsyncTask вот так
private class WolframFeed extends AsyncTask<Void, Void, String> {
private WAException exception;
@Override
protected String doInBackground(Void... params) {
String result="";
inputText = "solve " +resultt.getText().toString();
try {
Log.e("TRYing", "wolfram try/");
WAEngine engine = new WAEngine();
engine.setAppID(APP_ID);
//engine.addPodState("Result__Step-by-step solution");
engine.addFormat("plaintext");
WAQuery query = engine.createQueryFromURL(createFullURL());
/*WAQuery query = engine.createQuery();
query.setInput(inputText);*/
WAQueryResult queryResult = engine.performQuery(query);
if (queryResult.isError()) {
String err= "Query error" + " error code: " + queryResult.getErrorCode() + " error message: " + queryResult.getErrorMessage();
Log.e("err: ",err);
} else if (!queryResult.isSuccess()) {
Log.e("err: " ,"Query was not understood; no results available.");
} else {
// Got a result.
Log.e("err: ","Successful query. Pods follow:\n");
for (WAPod pod : queryResult.getPods()) {
if (!pod.isError()) {
result+="\n";
for (WASubpod subpod : pod.getSubpods()) {
for (Object element : subpod.getContents()) {
if (element instanceof WAPlainText) {
if(((WAPlainText) element).getText()!=""){
result+=pod.getTitle();
result+= ((WAPlainText) element).getText();
result+="\n";
}
}
}
}
}
}
}
} catch (WAException e) {
e.printStackTrace();
}
return result;
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
resultview.setText(result);
}
}
Пожалуйста, помогите мне, где я делаю ошибку.