Code example for AlertDialog

Methods: cancel

0
			Button b = (Button) view.findViewById(R.id.cancel);
			b.setOnClickListener(new OnClickListener() {
 
				public void onClick(View view) {
					// cancel 
					d.cancel();
				} 
 
			}); 
			b = (Button) view.findViewById(R.id.ok);
			b.setOnClickListener(new OnClickListener() {
 
				public void onClick(View view) {
 
					// add trimmed category 
					String newCat = editView.getText().toString().trim();
 
					if (newCat.length() > 0) {
						ContentValues cs = new ContentValues();
						cs.put(Categories.NAME, newCat);
						Uri uri = mNews.insertIfNotExists(