首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

剔除标签

2012-09-14 
删除标签public final void deleteBookmark(Cursor cur, int pos) {? ? //fetching info? ? ((Cursor) cur

删除标签

public final void deleteBookmark(Cursor cur, int pos) {? ? //fetching info? ? ((Cursor) cur).moveToPosition(pos);? ? final String bookmark_id = ((Cursor) cur).getString(((Cursor) cur).getColumnIndex(Browser.BookmarkColumns._ID));? ? final String bookmark_title = ((Cursor) cur).getString(((Cursor) cur).getColumnIndex(Browser.BookmarkColumns.TITLE));? ? //asking user to approve delete request? ? AlertDialog alertDialog = new AlertDialog.Builder(Dmarks.this).create();? ? alertDialog.setTitle("Delete" + " " + bookmark_title);? ? alertDialog.setIcon(R.drawable.icon);? ? alertDialog.setMessage("Are you sure you want to delete this Bookmark?");? ? alertDialog.setButton("OK", new DialogInterface.OnClickListener() {? ? ? ? ? public void onClick(DialogInterface dialog, int which) {? ? ? ? ? ? ?//deleting if user approved? ? ? ? ? ? ?getContentResolver().delete(Browser.BOOKMARKS_URI, "_id = " + bookmark_id, null);? ? ? ? ? ? ?//notifying user for deletion? ? ? ? ? ? ?Context context = getApplicationContext();? ? ? ? ? ? ?Toast.makeText(context, bookmark_title + " " + "deleted" , Toast.LENGTH_SHORT).show();? ? ? ? ? } });? ? alertDialog.setButton2("Cancel", new DialogInterface.OnClickListener() {? ? ? ? ? public void onClick(DialogInterface dialog, int which) {? ? ? ? ? ? ? Context context = getApplicationContext();? ? ? ? ? ? ? Toast.makeText(context, "canceled" , Toast.LENGTH_SHORT).show();? ? ? ? } });? ? alertDialog.show();? ? }}

热点排行