Q:

Display Specific Profile when the login Success?

I am not able to display the Specific UserName in the Navigation Drawer.
http://192.168.100.5:84/api/academics/students is the api for the total students.
when i use with the specific id as given below ,the name is displayed but it is static with providing the id.i want to send id as the parameter in the route
http://192.168.100.5:84/api/academics/students/1(id) with the specific id.
    How can this be achieved?
{

    "StdID":1,
    "NAME":"Kirsten Green",
    "PHONENO":"095-517-0049",
    "DOB":"2009-12-28T00:00:00",
    "CLASS":9,
    "GENDER":"M",
    "ADDRESS":"8254 At Ave",
    "NATIONALITY":"Belgium",
    "ENROLLEDYEAR":"2016-04-21T00:00:00",
    "Photo":null,
    "Cat_ID":5,
    "base64":null,
    "studentDetails":{
        "StdID":1,
        "GUARDIAN_PHONE_NO":"002-283-4824",
        "MOBILE_NO":"1-377-762-8548",
        "First_NAME":"Maile",
        "Last_Name":"Lancaster",
        "Relation":"Father",
        "DOB":"2017-02-22T00:00:00",
        "Education":"Ph.D",
        "Occupation":"Etiam ligula tortor,",
        "Income":"20000-30000",
        "Email":"urna@sed.ca",
        "AddLine1":"Ap #416-4247 Sollicitudin Av.",
        "AddLine2":"Ap #801-7380 Imperdiet Avenue",
        "State":"ME",
        "Country":"Israel"
    },
    "Marks":null,
    "stdCategory":{
        "Cat_ID":5,
        "Category":"Normal"
    }

}

myjava class
public class Home extends AppCompatActivity implements View.OnClickListener {
LinearLayout calendar, classSchedule, progressReport, profile, fee, dshboard, setting, logout, attendance;
android.support.v4.app.FragmentManager fragmentManager;
public static final String Navigation_URL = "http://192.168.100.5:84/api/academics/students/";
ImageView studentprofileimage;
TextView profilename;

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

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    studentprofileimage = (ImageView) findViewById(R.id.avatar);//initilise student name
    profilename = (TextView) findViewById(R.id.profilename);// student profile name

    dshboard = (LinearLayout) findViewById(R.id.dashboard_layout);
    calendar = (LinearLayout) findViewById(R.id.calender_layout);
    fee = (LinearLayout) findViewById(R.id.view_fee);
    classSchedule = (LinearLayout) findViewById(R.id.class_schedule);
    progressReport = (LinearLayout) findViewById(R.id.progress_report);
    profile = (LinearLayout) findViewById(R.id.view_profile);
    setting = (LinearLayout) findViewById(R.id.mainsetting);
    logout = (LinearLayout) findViewById(R.id.mainlogout);
    attendance = (LinearLayout) findViewById(R.id.class_attendance);

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
            this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.setDrawerListener(toggle);
    toggle.syncState();

    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setVisibility(View.VISIBLE);

    calendar.setOnClickListener(this);
    classSchedule.setOnClickListener(this);
    fee.setOnClickListener(this);
    dshboard.setOnClickListener(this);
    progressReport.setOnClickListener(this);
    profile.setOnClickListener(this);
    setting.setOnClickListener(this);
    logout.setOnClickListener(this);
    attendance.setOnClickListener(this);
    FragmentTransaction tx = getSupportFragmentManager().beginTransaction();
    tx.replace(R.id.container, new Dashboard());
    tx.commit();
    makeJsonObjectRequest(1);// what should be parameter

}

private void makeJsonObjectRequest(int stud_id) {
    String URL = Navigation_URL + stud_id;
    Log.d("TAG", "URL:" + URL);
    JsonArrayRequest movieReq = new JsonArrayRequest(URL,
            new Response.Listener<JSONArray>() {
                @Override
                public void onResponse(JSONArray response) {

                    for (int i = 0; i < response.length(); i++) {
                        try {

                            JSONObject obj = response.getJSONObject(i);
                            StudentInformation studentInformation = new StudentInformation();

                            // Login login = new Login();
                            //login.masterid= studentInformation.studentId = obj.getInt("StdID");
                            // String x = login.masterid;
                            // login.masterid = String.valueOf(studentInformation.studentId = obj.getInt("StdID"));
                            //  Log.d("All type", String.valueOf(x));

                            Integer id = studentInformation.studentId = obj.getInt("StdID");
                            String s = studentInformation.Name = obj.getString("NAME");
                            System.out.println();
                            profilename.setText(s);

                            Log.d("All type", String.valueOf(studentInformation.studentId));
                            Log.d("All type", studentInformation.Name);

                        } catch (JSONException e) {
                            e.printStackTrace();
                        }

                    }

                }
            },
            new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    Toast.makeText(Home.this, error.toString(), Toast.LENGTH_LONG).show();
                }
            });
    RequestQueue requestQueue = Volley.newRequestQueue(this);
    requestQueue.add(movieReq);

}

@Override
public void onBackPressed() {
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.START)) {
        drawer.closeDrawer(GravityCompat.START);
    } else {
        super.onBackPressed();
    }
}

@Override
public void onClick(View v) {

    int id = v.getId();

    if (id == R.id.dashboard_layout) {
        fragmentManager = getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.container, new Dashboard())
                .commit();

        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        drawer.closeDrawer(GravityCompat.START);

    } else if (id == R.id.calender_layout) {
        fragmentManager = getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.container, new CalenderFragment())
                .commit();

        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        drawer.closeDrawer(GravityCompat.START);
    } else if (id == R.id.view_fee) {
        fragmentManager = getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.container, new Fee())
                .commit();

        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        drawer.closeDrawer(GravityCompat.START);

    } else if (id == R.id.class_schedule) {

        fragmentManager = getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.container, new FragmentClassSchedule())
                .commit();

        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        drawer.closeDrawer(GravityCompat.START);
    } else if (id == R.id.progress_report) {

        fragmentManager = getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.container, new ProgressFragment())
                .commit();

        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        drawer.closeDrawer(GravityCompat.START);
    } else if (id == R.id.class_attendance) {

        fragmentManager = getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.container, new AttendanceStudentFragment())
                .commit();

        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        drawer.closeDrawer(GravityCompat.START);
    } else if (id == R.id.view_profile) {

        fragmentManager = getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.container, new ProfileFragment())
                .commit();
        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        drawer.closeDrawer(GravityCompat.START);
    } else if (id == R.id.mainsetting) {

        fragmentManager = getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.container, new SettingFragment())
                .commit();

        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        drawer.closeDrawer(GravityCompat.START);
    } else if (id == R.id.mainlogout) {

        fragmentManager = getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.container, new Dashboard())
                .commit();

        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        drawer.closeDrawer(GravityCompat.START);
    } else {
        fragmentManager = getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.container, new Dashboard())
                .commit();

        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        drawer.closeDrawer(GravityCompat.START);

    }

}

}
how can the specific id be send so that the will display the specific name?

A:

  public static final String Navigation_URL = "http://192.168.100.5:84/api/academics/students/";

  private void makeJsonObjectRequest(int stud_id) {
    String URL=Navigation_URL +stud_id;
    Log.d("TAG","URL:"+URL);
    StringRequest stringRequest = new StringRequest(Request.Method.GET, URL,
            new Response.Listener<String>() {
                @Override
                public void onResponse(String response) {
                    try {
                        JSONObject jsonObject = new JSONObject(response);
                        StudentInformation studentInformation = new StudentInformation();
                        studentInformation.Name = jsonObject.getString("NAME");
                        profilename.setText(studentInformation.Name);
                    } catch (JSONException e) {
                        Toast.makeText(getApplicationContext(), "Fetch failed!", Toast.LENGTH_SHORT).show();
                        e.printStackTrace();
                    }

                }

            },
            new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    Toast.makeText(Home.this, error.toString(), Toast.LENGTH_LONG).show();
                }
            });
    RequestQueue requestQueue = Volley.newRequestQueue(this);
    requestQueue.add(stringRequest);

}

