@Override public boolean onContextItemSelected(MenuItem item) { // TODO Auto-generated method stub AdapterView.AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); int menuItemIndex = item.getItemId(); if (menuItemIndex == 0) { RSSDatabaseHandler rssDb = new RSSDatabaseHandler(getApplicationContext()); WebSite site = new WebSite(); site.setId(Integer.parseInt(sqliteIds[info.position])); rssDb.deleteSite(site); Intent intent = getIntent(); finish(); startActivity(intent); } return true; }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.rss_item_list); // get intent data Intent i = getIntent(); // SQLite Row id Integer site_id = Integer.parseInt(i.getStringExtra("id")); // Getting Single website from SQLite RSSDatabaseHandler rssDB = new RSSDatabaseHandler(getApplicationContext()); WebSite site = rssDB.getSite(site_id); String rss_link = site.getRSSLink(); /** * Calling a backgroung thread will loads recent articles of a website * * @param rss url of website */ new loadRSSFeedItems().execute(rss_link); // selecting single ListView item ListView lv = getListView(); // Launching new screen on Selecting Single ListItem lv.setOnItemClickListener( new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent in = new Intent(getApplicationContext(), DisPlayWebPageActivity.class); // getting page url String page_url = ((TextView) view.findViewById(R.id.page_url)).getText().toString(); Toast.makeText(getApplicationContext(), page_url, Toast.LENGTH_SHORT).show(); in.putExtra("page_url", page_url); startActivity(in); } }); }