/** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.rss_reader);
    this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

    btnManage = (Button) findViewById(R.id.btn_manage);
    btnBrowse = (Button) findViewById(R.id.btn_browse);
    btnRefresh = (Button) findViewById(R.id.btn_refresh);
    btnSearch = (Button) findViewById(R.id.btn_search);

    btnManage.setOnClickListener(this);
    btnBrowse.setOnClickListener(this);
    btnRefresh.setOnClickListener(this);
    btnSearch.setOnClickListener(this);

    txtSearch = (EditText) findViewById(R.id.txt_search);

    init();

    boolean hasUpdate = false;
    try {
      hasUpdate = getIntent().getExtras().getBoolean("rss_update");
    } catch (NullPointerException e) {
      e.printStackTrace();
    }

    if (hasUpdate) {
      rssFeed = dbQuery.getUpdatedRssFeed();
      updateListView();
    } else loadData(null, true, false, true);
  }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);

    switch (item.getItemId()) {
      case R.id.mnu_exit:
        if (!isTaskRunning) finish();
        else
          Toast.makeText(RssReaderActivity.this, R.string.rss_keep_updating, Toast.LENGTH_SHORT)
              .show();
        break;
      case R.id.mnu_about:
        break;
      default:
        break;
    }
    return true;
  }
 @Override
 public void onDestroy() {
   dbQuery.closeDB();
   super.onDestroy();
 }