我正在使用改造 2 将我的数据发送到 MySQL 数据库中。我的代码有问题。如何解决这个错误
W/Looper: Slow Looper: doFrame is 4274ms late because of 3 msg, msg 1 took 4258ms (late=10ms h=android.view.ViewRootImpl$ViewRootHandler c=android.view.View$PerformClick)
Run Code Online (Sandbox Code Playgroud)
我也在我的代码中使用线程。
我的清单文件:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.education.education">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:usesCleartextTraffic="true"
android:theme="@style/AppTheme">
<activity android:name=".HomeActivity"></activity>
<activity android:name=".RegisterActivity" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
和我的响应代码。我第一次尝试没有处理程序之后,它会在许多答案建议添加处理程序时出现此错误。添加此处理程序后。发生同样的错误。如何解决这个问题呢:
Call<User> call = MainActivity.apiInstance.PerfomUserRegister(name, email, phone, password, uid);
call.equals(new Callback<User>() {
@Override
public void onResponse(Call<User> call, final Response<User> response) {
handler.postDelayed(new Runnable() {
@Override
public void run() {
User user = response.body();
String status = user.getResponse();
if(status.equals("ok"))
{
Toast.makeText(RegisterActivity.this, "Registration Success", Toast.LENGTH_SHORT).show();
}
else if(status.equals("failed")){
Toast.makeText(RegisterActivity.this, "Registration Failed", Toast.LENGTH_SHORT).show();
}
}
}, 1000);
}
@Override
public void onFailure(Call<User> call, Throwable t) {
Log.d(TAG, "onFailure: " + t);
}
});
Run Code Online (Sandbox Code Playgroud)
我有这个问题如何解决。
| 归档时间: |
|
| 查看次数: |
2836 次 |
| 最近记录: |