简体   繁体   中英

AsyncHttpClient OnSuccess or OnFailure was not overriden, but callback was received

Im trying to connect to my Android App with my MySQL database, but AsyncHttpClient is not invoking callbacks. I have overriden all OnSucces but it always says: W/JsonHttpRH: onSuccess(int, Header[], JSONObject) was not overriden, but callback was received

    cliente.get(LOGIN, params, new JsonHttpResponseHandler(true) {
        @Override
        public void onSuccess(int statusCode, Header[] headers, JSONObject    response) {
            super.onSuccess(statusCode, headers, response);
            try {
                if (response.getString("nombre").equals(user))
                    resultado[0] = true;
            } catch (JSONException e) {
                    resultado[0] = false;
            }
        }

        @Override
        public void onSuccess(int statusCode, Header[] headers, String responseString) {
            super.onSuccess(statusCode, headers, responseString);
            resultado[0] = true;
        }

        @Override
        public void onSuccess(int statusCode, Header[] headers, JSONArray response) {
            super.onSuccess(statusCode, headers, response);
            resultado[0] = true;
        }

        @Override
        public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
            super.onFailure(statusCode, headers, responseString, throwable);
            resultado[0] = false;
        }
    });

My AndroidManifest looks like:

enter code here<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.carlos.reservasaula">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity
        android:name=".ActivityLogin"
        android:label="@string/title_activity_activity_login"
        android:theme="@style/AppTheme.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

Where is my code failing? I used Log but nothing were logged. I tried an invalid URL and it doesnt care what onFailure method I call, it's never invoked. The url I'm trying to download data is https://ohmysoft.pw/reservasAula/api/aulas

You should not call super.onFailure() or super.onSuccess() . Those warnings come from super methods when you're not overriding them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM