N
N
nikita_chiru2016-08-14 13:47:14
Android
nikita_chiru, 2016-08-14 13:47:14

How to overcome the error This class should provide a default constructor?

Error:Error: This class should provide a default constructor (a public constructor with no arguments) (com.saleup.foodhause67.LoginRequest) [Instantiatable]

package com.saleup.foodhause67;

import com.android.volley.Response;
import com.android.volley.toolbox.StringRequest;

import java.util.HashMap;
import java.util.Map;

public class LoginRequest extends StringRequest {
    private static final String LOGIN_REQUEST_URL = "http://server.food-house67.ru/LoginFD.php";
    private Map<String, String> params;


    public LoginRequest(String namber, String password, Response.Listener<String> listener) {
        super(Method.POST, LOGIN_REQUEST_URL, listener, null);
        params = new HashMap<>();
        params.put("namber", namber);
        params.put("password", password);
    }



    @Override
    public Map<String, String> getParams() {
        return params;
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
z0rgoyok, 2016-08-14
@z0rgoyok

They want a constructor without parameters from you

public LoginRequest() {
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question