I have a recyclerviewholder that contains edittext fields.
In the edittext fields, I'm trying to update a specific SQLite values using TextChangedListener so that it will automatically update SQLite values without pressing any button. But it throws a NullPointerException
My OnCreateView
SQLiteCBLCAdapter sqliteCBLCAdapter;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    view = inflater.inflate(R.layout.fragment_tab_cart, container, false);
    ButterKnife.setDebug(true);
    ButterKnife.bind(this, view);
    sqliteCBLCAdapter = new SQLiteCBLCAdapter(getContext());
    return view;
}
This is my onTextChangedListener method
  @Override
  public void onTextChanged(CharSequence s, int start, int before, int count) {
      try {
          if (!s.equals("")) {
              String newQuantity = s.toString();
              sqliteCBLCAdapter.updateQuantity(orderName, newQuantity);
          } else {
              // irrelevant to the question
          }
      } catch (NumberFormatException e) {
          holder.tv_currentPrice_atc.setText("0");
      }
  }
And this is my updateQuantity method.
  public void updateQuantity(String orderName, String newQuantity) {
      SQLiteDatabase sqLiteDatabase = sqLiteCBLC.getWritableDatabase();
      String updateQuery = "UPDATE "+SQLiteCBLC.TABLE_NAME+" SET "+SQLiteCBLC.COL_QUANTITY+" = "+newQuantity+" WHERE "+SQLiteCBLC.COL_ORDNAME+" = '"+orderName+"'";
      sqLiteDatabase.execSQL(updateQuery);
  }
This is my logs
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.steven.frio.systemanalysisanddesign.sqlite.SQLiteCBLCAdapter.updateQuantity(java.lang.String, java.lang.String)' on a null object reference
                                                                                         at com.steven.frio.systemanalysisanddesign.FragmentTabCart$2.onTextChanged(FragmentTabCart.java:204)
                                                                                         at android.widget.TextView.sendOnTextChanged(TextView.java:8189)
                                                                                         at android.widget.TextView.setText(TextView.java:4485)
                                                                                         at android.widget.TextView.setText(TextView.java:4339)
                                                                                         at android.widget.EditText.setText(EditText.java:89)
                                                                                         at android.widget.TextView.setText(TextView.java:4314)
                                                                                         at com.steven.frio.systemanalysisanddesign.FragmentTabCart$1.addButtonClick(FragmentTabCart.java:138)
                                                                                         at com.steven.frio.systemanalysisanddesign.recycleradapters.RAdapterAddToCart$1.onClick(RAdapterAddToCart.java:80)
                                                                                         at android.view.View.performClick(View.java:5620)
                                                                                         at android.view.View$PerformClick.run(View.java:22300)
                                                                                         at android.os.Handler.handleCallback(Handler.java:754)
                                                                                         at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                                         at android.os.Looper.loop(Looper.java:160)
                                                                                         at android.app.ActivityThread.main(ActivityThread.java:6237)
                                                                                         at java.lang.reflect.Method.invoke(Native Method)
                                                                                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:877)
                                                                                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
When initializing sqliteCBLCAdapter inside the textchangedlistener/ parent method of the listener it throws this exception
Process: com.steven.frio.systemanalysisanddesign, PID: 22921
                                                                                     java.lang.NullPointerException: Attempt to invoke virtual method 'android.database.sqlite.SQLiteDatabase android.content.Context.openOrCreateDatabase(java.lang.String, int, android.database.sqlite.SQLiteDatabase$CursorFactory, android.database.DatabaseErrorHandler)' on a null object reference
                                                                                         at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:223)
                                                                                         at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163)
                                                                                         at com.steven.frio.systemanalysisanddesign.sqlite.SQLiteCBLCAdapter$SQLiteCBLC.<init>(SQLiteCBLCAdapter.java:115)
                                                                                         at com.steven.frio.systemanalysisanddesign.sqlite.SQLiteCBLCAdapter.<init>(SQLiteCBLCAdapter.java:21)
                                                                                         at com.steven.frio.systemanalysisanddesign.FragmentTabCart.editTextWatchers(FragmentTabCart.java:189)
                                                                                         at com.steven.frio.systemanalysisanddesign.recycleradapters.RAdapterAddToCart.onBindViewHolder(RAdapterAddToCart.java:75)
                                                                                         at com.steven.frio.systemanalysisanddesign.recycleradapters.RAdapterAddToCart.onBindViewHolder(RAdapterAddToCart.java:30)
                                                                                         at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6356)
 
    