I'm a novice If possible check out the following code I don't understand the problem My program is trying to upload a file to the server. But in this part of the code there is an error That is not understandable to me
error:class anonymous class derived from asynchttpResponsehandler must either be declared abstract or implement abstract method onsuccess()in asynchttpResponsehandler
package com.ehhg.upap1;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.preference.PreferenceActivity;
import android.provider.MediaStore;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v4.text.PrecomputedTextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.PrecomputedText;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;
import android.Manifest;
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpRequest;
import com.loopj.android.http.*;
import com.loopj.android.http.RequestParams;
import com.squareup.picasso.Picasso;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.io.FileNotFoundException;
import java.nio.file.FileSystemNotFoundException;
import java.security.acl.Permission;
import java.util.jar.Manifest.*;
import cz.msebera.android.httpclient.entity.mime.Header;
public void uploadImage(File file) {
AsyncHttpClient myClient = new AsyncHttpClient();
RequestParams params = new RequestParams();
try {
params.put("file", file);
} catch (FileNotFoundException e) {
}
myClient.post(url + "android/upload.php", params, new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
try {
JSONObject jsonObject = new JSONObject(new String(responseBody));
if (jsonObject.getString("status").equals("success")) {
Picasso.with(getBaseContext())
.load(url + "android/uploads/" + jsonObject.getString("filename"))
.into(img);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
Toast.makeText(getBaseContext(), new String(responseBody), Toast.LENGTH_LONG).show();
}
});
}