队列在android类中未知

时间:2019-06-12 13:54:54

标签: android queue android-volley

Volley RequestQueue Unknown Class?

这对我不起作用。凌空抽射是一个额外的障碍。所以有应用程序和齐射。它是否正确?看来课程队列是未知的。

package com.monchsoftware.planer;

import android.support.v7.app.AppCompatActivity;
import android.util.Log;

import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import java.util.HashMap;
import java.util.Map;

public class Test extends AppCompatActivity {

    public static void Sende() {

        String url = "http://localhost/php_test_neuer_user.php";
        StringRequest postRequest = new StringRequest(Request.Method.POST, url,
                new Response.Listener<String>() {
                    @Override
                    public void onResponse(String response) {
                        // response
                        Log.d("Response", response);
                    }
                },
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {
                        // error
                        String response = "";
                        Log.d("Error.Response", response);
                    }
                }
        )
        {
            @Override
            protected Map<String, String> getParams() {
                Map<String, String> params = new HashMap<String, String>();
                params.put("email", "test@test.com");
                params.put("name", "asd");
                params.put("telephone", "asd");

                return params;
            }
        };
        queue.add(postRequest);

    }
}

如何“导入”队列?

0 个答案:

没有答案