private void updateScore(String username, int score) {
   String url = "http://203.151.92.187:8080/updateAssignmentScore";
   String param =
       "sessionId="
           + URLEncoder.encode(SingletonID.getInstance().getSessionId())
           + "&courseId="
           + URLEncoder.encode(courseId)
           + "&username="******"&title="
           + URLEncoder.encode(title)
           + "&score="
           + URLEncoder.encode(String.valueOf(score));
   String result = "Fail";
   try {
     HttpPostConnection httpPostConnection = new HttpPostConnection();
     httpPostConnection.execute(url, param);
     String strJson = httpPostConnection.get();
     JSONObject jsonObject = new JSONObject(strJson);
     result = jsonObject.getString("status");
   } catch (ExecutionException e) {
     e.printStackTrace();
   } catch (InterruptedException e) {
     e.printStackTrace();
   } catch (JSONException e) {
     e.printStackTrace();
   }
   Toast.makeText(getApplicationContext(), result, Toast.LENGTH_SHORT).show();
 }
 public void onSectionAttached(int number) {
   switch (number) {
     case 1:
       if (getSupportFragmentManager().getFragments().size() > 1) {
         Intent intent = new Intent(this, MainActivity.class);
         intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
         startActivity(intent);
         finish();
       }
       break;
     case 2:
       startActivity(new Intent(this, SearchActivity.class));
       break;
     case 3:
       if (SingletonID.getInstance().getStatus() == 0)
         startActivity(new Intent(this, AnnStdActivity.class));
       else startActivity(new Intent(this, SearchStudentActivity.class));
       break;
     case 4:
       if (SingletonID.getInstance().getStatus() == 0) {
         startActivity(new Intent(this, MyCourseActivity.class));
       } else startActivity(new Intent(this, CreateSubjectActivity.class));
       break;
     case 5:
       if (SingletonID.getInstance().getStatus() == 0) {
         SingletonID.getInstance().clear();
         FacebookSdk.clearLoggingBehaviors();
         Intent intent = new Intent(this, LoginActivity.class);
         intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
         startActivity(intent);
         finish();
       } else { // my course teacher
         startActivity(new Intent(this, MyCourseTeacherActivity.class));
       }
       break;
     case 6:
       if (SingletonID.getInstance().getStatus() == 1) {
         SingletonID.getInstance().clear();
         Intent intent = new Intent(this, LoginActivity.class);
         intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
         startActivity(intent);
         finish();
       }
       break;
   }
 }