Q:

Value isn't assigned to variable in Responselistener

So, I'm trying to build and app in androidstudio and I want to retrieve some data from a mysql database and use this in the app.  I use a php script online and a responselistener to retrieve the data.  This whole part is working.  But when I assign the value I retrieved (called ID within the JSON object) to a String variable called entries, it doesnt like save it or something.  When i call the value in setData(), it returns null.  can someone shed some light on it? 
public class MainActivity extends AppCompatActivity {

EditText editText;

public String entries;

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

editText = (EditText) findViewById(R.id.text);

getData();
setData();

}

public void getData(){
    Response. Listener<String> responseListenerCount = new Response. Listener<String>() {
        @Override
        public void onResponse(String response) {
            Log.d("JSON Parser", response);
            try {
                JSONObject jsonResponse = new JSONObject(response);
                boolean success = jsonResponse.getBoolean("success");
                if (success) {

                entries = jsonResponse.getString("ID"); // HERE THE RETRIEVED VALUE IS ASSIGNED TO VARIABLE ENTRIES
                Toast.makeText(getApplicationContext(), " Retrieving success ", Toast. LENGTH_SHORT).show();
            } else {
                Toast.makeText(getApplicationContext(), " Retrieving failed ", Toast. LENGTH_SHORT).show();
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        // HERE THAT VALUE IS NULL AGAIN
    }
};
CountRequest countRequest = new CountRequest(responseListenerCount);
RequestQueue queue = Volley.newRequestQueue(MainActivity.this);
queue.add(countRequest);

}

public void setData(){
    editText.setText(entries);
}}

And this the countRequest.java which is called in the requestqueue.  Again; this part is working fine, so it's not really relevant. 
public class CountRequest extends StringRequest {

private static final String LOGIN_REQUEST_URL = "*************";
private Map<String, String> params;

public CountRequest(Response. Listener<String> listener){
    super(Request. Method. POST, LOGIN_REQUEST_URL, listener, null);
    params = new HashMap<>();
}

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

A:

I've tried your code but from my perspective it works well.  I've used this scripts:
public class MainActivity extends AppCompatActivity {

EditText editText;

public String entries="test";

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

    editText = (EditText) findViewById(R.id.text);

    getData();
    System.out.println(entries); //here id null or in my case "test"
    setData();

}

public void getData(){
    Response. Listener<String> responseListenerCount = new Response. Listener<String>() {
        @Override
        public void onResponse(String response) {
            Log.d("JSON Parser", response);
            try {
                JSONObject jsonResponse = new JSONObject(response);
                int success = jsonResponse.getInt("success");
                if (success==1) {

                    entries = jsonResponse.getString("user_id"); //geting user id
                   System.out.println(entries);
                    Toast.makeText(getApplicationContext(), " Retrieving success ", Toast. LENGTH_SHORT).show();
                } else {
                    Toast.makeText(getApplicationContext(), " Retrieving failed ", Toast. LENGTH_SHORT).show();
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }

            System.out.println(entries); //id is still there
            setData();
        }
    };
    CountRequest countRequest = new CountRequest(responseListenerCount);
    RequestQueue queue = Volley.newRequestQueue(MainActivity.this);
    queue.add(countRequest);
   System.out.println(entries); //here id null or in my case "test"
}

public void setData(){
    editText.setText(entries);
}}

public class CountRequest extends StringRequest {

private static final String LOGIN_REQUEST_URL = "http://mypage.com/login_user.php?login=a&password=b";
private Map<String, String> params;

public CountRequest(Response. Listener<String> listener){
    super(Request. Method. POST, LOGIN_REQUEST_URL, listener, null);
    params = new HashMap<>();
}

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

<? php

define('DB_USER', "*******"); // db user
define('DB_PASSWORD', "*******"); // db password 
define('DB_DATABASE', "*******"); // database name
define('DB_SERVER', "localhost"); // db server

class DB_CONNECT {

function __construct() {
    $this->connect();
}

function __destruct() {
    $this->close();
}

function connect() {

    $con = mysql_connect(DB_SERVER, DB_USER, DB_PASSWORD) or die(mysql_error());

    $db = mysql_select_db(DB_DATABASE) or die(mysql_error()) or die(mysql_error());

    return $con;
}

function close() {
    mysql_close();
}

}

? >

<? php

$response = array();

if (isset($_GET['login']) && isset($_GET['password'])) {

$login = $_GET['login'];
$password = $_GET['password'];

require_once __DIR__ . ' /db_connect.php';

$db = new DB_CONNECT();

$checkUser = mysql_query("Select * FROM user where login = '$login'");

 if(mysql_num_rows($checkUser)>0){

       $result = mysql_fetch_array($checkUser);
       $userpassword = $result["password"];
       $user_id = $result["user_id"];

       $response["success"] = 1;
       $response["message"] = $userpassword;
       $response["user_id"] = $user_id;
       echo json_encode($response);
 }

 else{
       $response["success"] = 0;
       $response["message"] = "User not found";
       echo json_encode($response);
 }
 }
else {
$response["success"] = 0;
$response["message"] = "Required field(s) is missing";

echo json_encode($response);
}

? >

I think that if you are getting error, then it is in LOGIN_REQUEST_URL/params or in PHP script as in places where you asked I am getting data from DB.  Although in this case setData() in onCreate method will always return null.  You are setting the value of 'entries' on the response which works in background.  So your code is coming to GetData() sending request to server and moves on to next command which is setData(), not waiting for downloaded info.