android - 意外的响应代码 200

标签 android api android-volley

12-02 12:26:58.984 4028-4069/com.example.sainathpawar.volleyimage E/Volley: [162] BasicNetwork.performRequest: Unexpected response code 200 for http://lorempixel.com/600/400/city/ 12-02 12:26:58.985 4028-4028/com.example.sainathpawar.volleyimage I/Error: Error 12-02 12:27:00.262 4028-4068/com.example.sainathpawar.volleyimage E/Volley: [161] BasicNetwork.performRequest: Unexpected response code 200 for http://lorempixel.com/600/400/city/ 12-02 12:27:00.264 4028-4028/com.example.sainathpawar.volleyimage I/Error: Error

出现上述错误此错误是什么意思?我正在尝试从 API“http://lorempixel.com/600/400/city/”获取图像是否与权限有关?

以下是我收到错误的代码。

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        final String myURL = "http://lorempixel.com/600/400/city/";

        Button myButton = findViewById(R.id.button);
        ImageView imageView = findViewById(R.id.imageView);
        myButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ImageRequest imageRequest = new ImageRequest(myURL,
                        new Response.Listener<Bitmap>() {
                            @Override
                            public void onResponse(Bitmap response) {

                            }
                        }, 0, 0, null, new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {
                        Log.i("Error","Error");
                    }
                });
                MySingleton.getmInstance(MainActivity.this).addToRequest(imageRequest);
            }
        });
    }

    }

最佳答案

我通过将域更改为真实 IP 地址来解决它:

var socket = io.connect('http://182.92.79.215:3007');

关于android - 意外的响应代码 200,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47605489/

相关文章:

android - 从服务更新 UI

Android Layout透明布局背景带下划线

android - 错误 :Execution failed for task ':app:processDebugResources' . > 在索引 4

c# - 使用 TLsharp 进行 Telegram 编程时出现 PHONE_MIGRATE_X 错误

android - 通过 Android-Volley 获取 JSON 对象

java - 将截击结果返回到不同的类(class)

android - 在 FragmentActivity 中创建自定义选项卡

C、Windows API在注册表项后创建文件夹结构

api - 为什么 fold 在 Scala 中有以下类型?

android - 更改状态代码 Rails