title: Database Helper null object reference when trying to fetch the data from SQLite database , no such table: Offices (code 1)
body: <p>I'm using Android Library SQLiteAssetHelper to Read Sqlite database file ,and to  populate my RecycleryView from the SQLite database ...</p>
  
  <p>Here's my DataBase Helper :</p>
  
  <pre><code>public class DBHelper extends SQLiteOpenHelper {
  private static final String DATABASE_NAME = "db.sql";
  private static final int DATABASE_VERSION = 1;
  private static final String ID="ID";
  private static final String NAME="Name";
  private static final String IMAGE="Img";
  private static final String Location="Location";
  private static final String Offices_Table="Offices";
  
  
  
  public DBHelper(Context context) {
      super(context, DATABASE_NAME, null, DATABASE_VERSION);
  }
  
  public ArrayList&lt;Office&gt; GetOffices(){
      SQLiteDatabase sqLiteDatabase=getWritableDatabase();
      String[] columns={DBHelper.ID,DBHelper.NAME,DBHelper.IMAGE,DBHelper.Location};
      Cursor cursor=sqLiteDatabase.query(DBHelper.Offices_Table, columns, null, null, null, null, null);
      ArrayList&lt;Office&gt; offices = new ArrayList&lt;&gt;();
  
      while(cursor.moveToNext()){
          Office office=new Office();
          office.officeID=cursor.getInt(cursor.getColumnIndex(DBHelper.ID));
          office.officeName=cursor.getString(cursor.getColumnIndex(DBHelper.NAME));
  
          office.officeLocation=cursor.getString(cursor.getColumnIndex(DBHelper.Location));
          offices.add(office);
      }
      return offices;
  }
  
  @Override
  public void onCreate(SQLiteDatabase db) {}
  
  @Override
  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {}}
  </code></pre>
  
  <p>And this is my  POJO class Office.java :</p>
  
  <pre><code>public class Office {
  
  public int officeID;
  public String officeName;
  public   int officeImg;
  public String officeInfo;
  public int officeRate;
  public String officeLocation;
  
  public Office(String officeName, int officeImg , String officeLocation) {
      this.officeName = officeName;
      this.officeImg = officeImg;
      this.officeLocation=officeLocation;
  }
  
  public Office() {
  }
  
  public Office(int officeID, String officeName, int officeImg, String officeInfo, int officeRate, String officeLocation) {
      this.officeID = officeID;
      this.officeName = officeName;
      this.officeImg = officeImg;
      this.officeInfo = officeInfo;
  
      this.officeRate = officeRate;
      this.officeLocation = officeLocation;
  }
  
  public void setOfficeID(int officeID) {
      this.officeID = officeID;
  }
  
  public void setOfficeName(String officeName) {
      this.officeName = officeName;
  }
  
  public void setOfficeImg(int officeImg) {
      this.officeImg = officeImg;
  }
  
  public void setOfficeInfo(String officeInfo) {
      this.officeInfo = officeInfo;
  }
  
  public void setOfficeRate(int officeRate) {
      this.officeRate = officeRate;
  }
  
  public void setOfficeLocation(String officeLocation) {
      this.officeLocation = officeLocation;
  }
  
  public int getOfficeID() {
      return officeID;
  }
  
  public String getOfficeName() {
      return officeName;
  }
  
  public int getOfficeImg() {
      return officeImg;
  }
  
  public String getOfficeInfo() {
      return officeInfo;
  }
  
  public int getOfficeRate() {
      return officeRate;
  }
  
  public String getOfficeLocation() {
      return officeLocation;
  }}
  </code></pre>
  
  <p>Initialize DatabaseHelper file and load data from sqlite database file to Application in OfficesActivity.java file</p>
  
  <pre><code>public class Offices extends AppCompatActivity {
  
  RecyclerView recyclerView ;
  OfficeAdapter officeAdapter;
  List&lt;Office&gt; officeDataList;
  List&lt;Integer&gt; officesImg;
  DBHelper dbHelper;
  Cursor cursor;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_offices);
  
      recyclerView = (RecyclerView) findViewById(R.id.recyclerview_paths);
      officeDataList = dbHelper.GetOffices();
      officeAdapter = new OfficeAdapter(this , officeDataList);
      RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(this);
      recyclerView.setLayoutManager(mLayoutManager);
      recyclerView.setAdapter(officeAdapter);
  
  }}
  </code></pre>
  
  <p>The Tracetrack Log:</p>
  
  <pre><code>                                                                                        java.lang.RuntimeException: Unable to start activity ComponentInfo{com.artline.ministryoftourismpalestine/com.artline.ministryoftourismpalestine.Offices}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.ArrayList com.artline.ministryoftourismpalestine.DBHelper.GetOffices()' on a null object reference
  </code></pre>
  
  <p>From the tractrack i know the Office class attributes are null and the OfficeAdapter takes empty list , But how can i solve the problem ? What is the cause?</p>
  
  <p>The problem is solved , thank to VSB .. </p>
  
  <p>But i'm getting error that saying there's not such a table ..</p>
  
  <p>The log error:</p>
  
  <pre><code>                                                                                      java.lang.RuntimeException: Unable to start activity ComponentInfo{com.artline.ministryoftourismpalestine/com.artline.ministryoftourismpalestine.Offices}: android.database.sqlite.SQLiteException: no such table: Offices (code 1): , while compiling: SELECT ID, Name, Img, Location FROM Offices
  </code></pre>