AlertDialog Example

AlertDialog Example

    @Override
        public boolean onOptionsItemSelected(MenuItem item) {
            if(item.getItemId()==R.id.hakkimda)
            {
                AlertDialog.Builder  builder = new AlertDialog.Builder(MainActivity.this);
                builder.setMessage("THIS IS A TEST");
                builder.setCancelable(false);
                
                    builder.setNegativeButton("ok", new DialogInterface.OnClickListener() {
                        
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            dialog.cancel();
                        }
                    });
                AlertDialog alert = builder.create();
                alert.show();    
            
            }
            
            return super.onOptionsItemSelected(item);
        }