Exemplo n.º 1
0
  public void getMasterProfile(Context ctx) {

    dbUtil = new DatabaseUtil(ctx);
    dbUtil.open();
    dbUtil.fetchMasterProfile();

    dbUtil.close();
  }
Exemplo n.º 2
0
  public User loadMasterProfile(Context ctx) {

    dbUtil = new DatabaseUtil(ctx);
    dbUtil.open();

    User tempUser = new User();
    // String name="sun";

    Cursor cursor = dbUtil.fetchMasterProfile();
    /*
    		tempUser.setUser(cursor.getString(0));
    		tempUser.setGender(cursor.getString(1));
    		tempUser.setDob(cursor.getString(2));
    		tempUser.setWeight(cursor.getFloat(3));
    		tempUser.setHeight(cursor.getFloat(4));
    		tempUser.setDesc(cursor.getString(5));
    		//tempUser.setType(cursor.getString(6));
    		Toast.makeText(ctx, "Got Master Profile 1", Toast.LENGTH_LONG).show();

    */
    tempUser.setUser("na");

    try {

      if (cursor != null) {
        // while (cursor.moveToNext()) {
        tempUser.setUser(cursor.getString(0));
        tempUser.setGender(cursor.getString(1));
        tempUser.setDob(cursor.getString(2));
        tempUser.setWeight(cursor.getFloat(3));
        tempUser.setHeight(cursor.getFloat(4));
        tempUser.setDesc(cursor.getString(5));
        // tempUser.setType(cursor.getString(6));
        Toast.makeText(ctx, "Got Master Profile", Toast.LENGTH_LONG).show();

        // }
      } else Toast.makeText(ctx, "No Master Profile", Toast.LENGTH_LONG).show();
    } catch (CursorIndexOutOfBoundsException e) {

      ToastTest.getToastTest().toastTest("Add Master Profile First");
    }

    dbUtil.close();
    /*
    if (tempUser.getUser().equalsIgnoreCase("na")) {
    	tempUser.setUser(profile);
    	init(ctx, tempUser);

    }*/

    return tempUser;
  }