title: Why is the getAllBurnCaloriesDatas() returned 0 and List View not showing up?
body: <p>I would like to know why my list view isn't displaying my calories burn history after clicking "More". </p>
  
  <p>BurnDatabaseHelper.java:</p>
  
  <pre><code>public class BurnDatabaseHelper extends SQLiteOpenHelper {
  
      // Calories Burned
      public static final String KEY_CALORIES_BURN_ID = "_id";
      public static final String KEY_CALORIES_OUT_DATE = "calories_out_date";
      public static final String KEY_CALORIES_HOW_LONG = "calories_how_long";
      public static final String KEY_PACE = "pace";
      public static final String KEY_CALORIES_BURN = "calories_burn";
      public static final String KEY_CALORIES_BURN_QUICK = "calories_burn_quick";
  
      private static final String DATABASE_NAME = "leazy_calIntake.db";
      private static final String TABLE_CALORIES_BURN = "burn";
      private static final int DATABASE_VERSION = 1;
  
      public BurnDatabaseHelper(Context context) {
          super(context, DATABASE_NAME, null, DATABASE_VERSION);
      }
  
      @Override
      public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
          // TODO Auto-generated method stub
          db.execSQL(" DROP TABLE IF EXISTS " + TABLE_CALORIES_BURN);
          onCreate(db);
  
      }
  
      @Override
      public void onCreate(SQLiteDatabase db) {
          // TODO Auto-generated method stub
          String DATABASE_CREATE_CALORIES_BURN = "CREATE TABLE "
                  + TABLE_CALORIES_BURN + " (" //
                  + KEY_CALORIES_BURN_ID + " integer primary key autoincrement,"//
                  + KEY_CALORIES_OUT_DATE + " long"//
                  + KEY_CALORIES_HOW_LONG + " integer,"//
                  + KEY_PACE + " integer,"//
                  + KEY_CALORIES_BURN + " integer," //
                  + KEY_CALORIES_BURN_QUICK + " integer" //
                  + " );";
  
          db.execSQL(DATABASE_CREATE_CALORIES_BURN);
  
      }
  
      public void insertBurnedCalories(BurnedCalData burnData) {
  
          ContentValues values = new ContentValues();
  
          values.put(KEY_CALORIES_OUT_DATE, burnData.getCalOutDate());
          Log.d("dbBurn", "date burn " + burnData.getCalOutDate());
          values.put(KEY_CALORIES_HOW_LONG, burnData.getHowLong());
          Log.d("dbBurn", "db how long= " + burnData.getHowLong());
          values.put(KEY_PACE, burnData.getPace());
          Log.d("dbBurn", "db pace= " + burnData.getPace());
          values.put(KEY_CALORIES_BURN, burnData.getCaloriesBurn());
          Log.d("dbBurn", "db BURNed calories= " + burnData.getCaloriesBurn());
          values.put(KEY_CALORIES_BURN_QUICK, burnData.getCaloriesQuickBurn());
          Log.d("dbBurn", "db quick BURNed calories= " + burnData.getCaloriesQuickBurn());
  
  
          SQLiteDatabase db = this.getWritableDatabase();
          db.insert(TABLE_CALORIES_BURN, null, values);
          db.close();
      }
  
      public Cursor getAllBurnCaloriesDatas() {
          // List&lt;Data&gt; historyDataList= new ArrayList&lt;Data&gt;();
          String selectQuery = "SELECT * FROM " + TABLE_CALORIES_BURN;
          SQLiteDatabase db = this.getWritableDatabase();
          Cursor cursor = db.rawQuery(selectQuery, null);
  
          String[] columnName = cursor.getColumnNames();
          for (String string : columnName) {
              Log.i("column", string);
          }
  
          return cursor;
      }
  
  
  }
  </code></pre>
  
  <p>Here, for the second problem I would like to ask for help is that I have my Activity which calls the MoreBurnFragment.java:</p>
  
  <p>MoreBurnActivity.java:</p>
  
  <pre><code>public class MoreBurnActivity extends ActionBarActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
          setContentView(R.layout.frame);
  
          ActionBar actionBar = getSupportActionBar();
          actionBar.setDisplayHomeAsUpEnabled(false);
  
          if (savedInstanceState == null) {
  
              MoreBurnFragment moreburnfragment = new MoreBurnFragment();
              Bundle extra = getIntent().getExtras();
              moreburnfragment.setArguments(extra);
  
              FragmentManager fm = getSupportFragmentManager();
              FragmentTransaction ft = fm.beginTransaction().add(
                      R.id.fragment_container, moreburnfragment);
  
              ft.commit();
  
          }
  
      }
  
  }
  </code></pre>
  
  <p>MoreBurnFragment.java:</p>
  
  <pre><code>public class MoreBurnFragment extends Fragment{
  
      private MoreBurnAdapter adapter;
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          View v = inflater.inflate(R.layout.fragment_more_burn, container, false);
  
          ((ActionBarActivity)getActivity()).getSupportActionBar();
  
          ListView mListView = (ListView) v.findViewById(R.id.listView_more_burn);
  
          BurnDatabaseHelper db = new BurnDatabaseHelper(getActivity());
          Cursor cursor = db.getAllBurnCaloriesDatas();
  
          if (cursor != null) {
              // adapter context
              adapter = new MoreBurnAdapter(getActivity(), cursor);
  
          }
  //      
          mListView.setAdapter(adapter);
  
  
  
  
          return v;
      }
  
  }
  </code></pre>
  
  <p>And last my adapter, MoreBurnAdapter.java:</p>
  
  <pre><code>public class MoreBurnAdapter extends CursorAdapter {
  
      public MoreBurnAdapter(Context context, Cursor cursor) {
          super(context, cursor, true);
      }
  
      @Override
      public void bindView(View view, Context context, Cursor cursor) {
          // TODO Auto-generated method stub
           long date = cursor.getLong(cursor.getColumnIndexOrThrow(BurnDatabaseHelper.KEY_CALORIES_OUT_DATE));
           Log.d("burnMore","date="+ date);
           int duration = cursor.getInt(cursor.getColumnIndexOrThrow(BurnDatabaseHelper.KEY_CALORIES_HOW_LONG));
           int pace = cursor.getInt(cursor.getColumnIndexOrThrow(BurnDatabaseHelper.KEY_PACE));
           int calBurn = cursor.getInt(cursor.getColumnIndexOrThrow(BurnDatabaseHelper.KEY_CALORIES_BURN));
           int quickBurn = cursor.getInt(cursor.getColumnIndexOrThrow(BurnDatabaseHelper.KEY_CALORIES_BURN_QUICK));
           int total = calBurn + quickBurn;
  
           ViewHolder history_holder = (ViewHolder) view.getTag();
  
           Calendar rightNow = Calendar.getInstance();//returns a calendar, is an object/instance created with a Calendar class
           rightNow.setTimeInMillis(date); //accessing rightNow class, set it to date(long).
  
           SimpleDateFormat format = new SimpleDateFormat("d/MM/yyyy   h:mm a", Locale.getDefault());
  
           String calBurnDate = format.format(rightNow.getTime());//return a date in string
           history_holder.datetime.setText(String.valueOf(calBurnDate));
           history_holder.duration.setText("Walking Duration : "+duration);
           history_holder.pace.setText("Pace: "+pace);
           history_holder.burn.setText("Calories burned: "+calBurn);
           history_holder.quick_burn.setText("Quick Burned: "+quickBurn);
           history_holder.total.setText("Total: "+total);
  
      }
  
      @Override
      public View newView(Context context, Cursor cursor, ViewGroup parent) {
          // TODO Auto-generated method stub
          LayoutInflater inflater = LayoutInflater.from(mContext);
          View view = inflater.inflate(R.layout.cal_out_history_row, parent, false);
  
          ViewHolder holder = new ViewHolder();
  
          holder.datetime = (TextView) view.findViewById(R.id.textView_datetime);
          holder.duration = (TextView) view.findViewById(R.id.textView_walkhowlong);
          holder.pace = (TextView) view.findViewById(R.id.textView_pace);
          holder.burn = (TextView) view.findViewById(R.id.textView_burn);
          holder.quick_burn = (TextView) view.findViewById(R.id.textView_quick_burn);
          holder.total = (TextView) view.findViewById(R.id.textView_totalburn);
  
  
          return view;
      }
  
      private class ViewHolder {
          TextView datetime, duration, pace, burn, quick_burn, total ;
      }
  
  }
  </code></pre>
  
  <p>Please help. The data is not showing up and no list view is shown. Million thanks in advance.</p>