@Override
 public void handleMessage(Message msg) {
   if (progressBar.VISIBLE == View.VISIBLE) {
     progressBar.setVisibility(View.GONE);
   }
   if (msg.what == 0) {
     // success
     CourseDBManager db = new CourseDBManager(LoginActivity.this);
     db.getDatabase();
     List<HashMap<String, String>> data = db.queryEnrollment(Utils.getUserName());
     Intent intent = new Intent(LoginActivity.this, MainActivity.class);
     intent.putExtra("data", (ArrayList) data);
     startActivity(intent);
     db.closeDB();
     LoginActivity.this.finish();
   }
   if (msg.what == -1) {
     Toast.makeText(LoginActivity.this, msg.obj.toString(), Toast.LENGTH_LONG).show();
   }
 }