Code example for View

Methods: getContext

0
    	super.onCreate(savedInstanceState);
    	view.setClickable(true); 
    	view.setOnClickListener(new OnClickListener() {
			@Override 
			public void onClick(View v) {
				new AlertDialog.Builder(v.getContext())
				.setMessage("Clicked!")
				.setTitle("onClickTest")
				.setPositiveButton("OK", new DialogInterface.OnClickListener() {
					@Override 
					public void onClick(DialogInterface dialog, int which) {
						dialog.dismiss();
					} 
				}) 
				.create().show();
			} 
		}); 
    } 
} 
Contextual code suggestions in your IDE  Get Codota for Java