title: notify RecyclerView adapter from fragment
body: <p>i have a RecyclerView with Dialog Fragment , and i get data from user in via the Dialog and stored it in the database then , i display it in recyclerview , and all this is working , my problem is , when i add the data i must restart the app to display it into recycler , how i can notify the adapter data is change ? </p>
  
  <p>the add button in the Dialog Fragment </p>
  
  <pre><code>  add = (Button) rootView.findViewById(R.id.addbutton);
      add.setOnClickListener(this);
  
   private void insert() {
          Title = addTitle.getText().toString();
          Des= addDesc.getText().toString();
          db.insertIntoDB(Title, Des);}
      @Override
      public void onClick(View v) {
          if (addTitle.getText().toString().trim().equals("")) {
              addTitle.setError(" Title is required!");
          } else if (addDesc.getText().toString().trim().equals("")) {
              addDesc.setError(" Postion is required!");
          }
  
          Toast.makeText(getContext(),"your data is saved", Toast.LENGTH_SHORT).show();
          insert();
      }
  </code></pre>
  
  <p>and this is the getdata method in the helper class </p>
  
  <pre><code>public List&lt;ToDoModule&gt; getDataFromDB(){
      List&lt;ToDoModule&gt; modelList = new ArrayList&lt;ToDoModule&gt;();
      String query = "select * from "+ TODO_TABLE;
      SQLiteDatabase db = this.getWritableDatabase();
      Cursor cursor = db.rawQuery(query,null);
      if (cursor.moveToFirst()){
          do {
  
              ToDoModule model = new ToDoModule();
              model.setActionTitle(cursor.getString(1));
              model.setActionDesc(cursor.getString(2));
              modelList.add(model);
          }while (cursor.moveToNext());
      }
      return modelList;
  }
  </code></pre>
  
  <p>and this is the main activity </p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  public List&lt;ToDoModule&gt; dbList;
  RecyclerView mRecyclerView;
  DatabaseHelpher helpher;
  private RecyclerView.Adapter mAdapter;
  private RecyclerView.LayoutManager mLayoutManager;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
      setSupportActionBar(toolbar);
      getSupportActionBar().hide();
      helpher = new DatabaseHelpher(this);
      dbList= new ArrayList&lt;ToDoModule&gt;();
      dbList = helpher.getDataFromDB();
      mRecyclerView = (RecyclerView)findViewById(R.id.AppRecyclerView);
      mRecyclerView.setHasFixedSize(true);
      mLayoutManager = new LinearLayoutManager(this);
      mRecyclerView.setLayoutManager(mLayoutManager);
      mAdapter = new RecyclerAdapter(this,dbList);
      this.dbList =helpher.getDataFromDB();
      mAdapter.notifyDataSetChanged();
      mRecyclerView.setAdapter(mAdapter);
      FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
      fab.setImageResource(R.drawable.ic_action_name);
      fab.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              FragmentManager fm = getSupportFragmentManager();
              addAction add = new addAction();
              add.show(fm,"fragment_edit_name");
          }});}
  
  @Override
  protected void onResume() {
      super.onResume();
  }
  }
  </code></pre>