@Override
 public void onReceive(Context context, Intent intent) {
   if (fileList == null) {
     fileList = new ArrayList<File>();
     listAdapt = new ListAdapt(context.getApplicationContext(), 0, fileList);
     for (File file : recDir.listFiles()) {
       fileList.add(file);
     }
     listView.setAdapter(listAdapt);
   } else {
     File[] files = recDir.listFiles();
     fileList.add(files[files.length - 1]);
     listAdapt.notifyDataSetChanged();
   }
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    /*if(CheckNetwork.isInternetAvailable(MainActivity.this)) //returns true if internet available
    {

        //do something. loadwebview.
    }
    else
    {
        Toast.makeText(MainActivity.this,"No Internet Connection",Toast.LENGTH_LONG).show();
    }*/

    listView = (ListView) findViewById(R.id.listView);
    registerForContextMenu(listView);
    listAdapt = new ListAdapt(getApplicationContext(), R.layout.list_layout);
    listView.setAdapter(listAdapt);
    listView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent launchNews = new Intent(MainActivity.this, Custom_NewsRead.class);
            startActivity(launchNews);
            view.setSelected(true);
          }
        });
    userDb = new UserDb(getApplicationContext());
    sqLiteDatabase = userDb.getReadableDatabase();
    cursor = userDb.viewList(sqLiteDatabase);

    if (cursor.moveToFirst()) {
      do {

        String website, websiteUrl;
        website = cursor.getString(0);
        websiteUrl = cursor.getString(1);
        Data data = new Data(website, websiteUrl);
        listAdapt.add(data);

      } while (cursor.moveToNext());
    }
  }