@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_profile_teacher);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_teacher);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    tv1 = (TextView) findViewById(R.id.teacher_name);
    tv2 = (TextView) findViewById(R.id.teacher_username);
    tv3 = (TextView) findViewById(R.id.teacher_class);
    tv4 = (TextView) findViewById(R.id.teacher_house);
    tv5 = (TextView) findViewById(R.id.teacher_subject);

    try {
      mClient =
          new MobileServiceClient(
              "https://testac.azure-mobile.net/", "vCLPlbZjAZwyyKXtsMzmzfQAOPzIIu77", this);
      // get the table
      mMobileTable = mClient.getTable(Teacher_Details.class);

    } catch (MalformedURLException e) {

      e.printStackTrace();
    }
    SharedPreferences a = getSharedPreferences("user", 0);
    String z = a.getString("username", "cgfh");
    item = new Teacher_Details();
    mMobileTable
        .where()
        .field("username")
        .eq(z)
        .execute(
            new TableQueryCallback<Teacher_Details>() {
              @Override
              public void onCompleted(
                  List<Teacher_Details> result,
                  int count,
                  Exception exception,
                  ServiceFilterResponse response) {
                if (exception == null) {
                  String a = result.get(0).Name;
                  String b = result.get(0).Contact;
                  String c = result.get(0).Email;
                  String d = result.get(0).Address;
                  String e = result.get(0).Subject;
                  tv1.setText(a);
                  tv2.setText(b);
                  tv3.setText(c);
                  tv4.setText(d);
                  tv5.setText(e);
                  // Toast.makeText(Profile_Teacher.this, a, Toast.LENGTH_SHORT).show();
                } else {
                  Toast.makeText(Profile_Teacher.this, "No", Toast.LENGTH_SHORT).show();
                }
              }
            });
  }
 public void addPatient(Patient patient) {
   patientTable.insert(
       patient,
       new TableOperationCallback<Patient>() {
         @Override
         public void onCompleted(
             Patient entity, Exception exception, ServiceFilterResponse response) {
           if (exception == null) {
             Log.d(TAG, "worked");
           } else {
             Log.e(TAG, Log.getStackTraceString(exception));
           }
         }
       });
 }
 /** Refresh the list with the items in the Mobile Service Table */
 private List<ToDoItem> refreshItemsFromMobileServiceTable()
     throws ExecutionException, InterruptedException {
   return mToDoTable.where().field("complete").eq(val(false)).execute().get();
 }
 /**
  * Add an item to the Mobile Service Table
  *
  * @param item The item to Add
  */
 public ToDoItem addItemInTable(ToDoItem item) throws ExecutionException, InterruptedException {
   ToDoItem entity = mToDoTable.insert(item).get();
   return entity;
 }
 /**
  * Mark an item as completed in the Mobile Service Table
  *
  * @param item The item to mark
  */
 public void checkItemInTable(ToDoItem item) throws ExecutionException, InterruptedException {
   mToDoTable.update(item).get();
 }
 public void updatePatient(Patient patient) {
   patientTable.update(patient);
 }
 public void addEmergency(Emergency emergency) {
   emergencyTable.insert(emergency);
 }
 public void updateEmergency(Emergency emergency) {
   emergencyTable.update(emergency);
 }