in your code you are exted dialogfragment so it is not an activity. you should extend Activity for that.
public class AdminActivity extends Activity{
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(AdminActivity.this);
builder.setTitle(R.string.layers)
.setItems(R.array.layer_options, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// The 'which' argument contains the index position
// of the selected item
}
});
return builder.create();
}
}
and in your main acitivity do this
map.setOnInfoWindowClickListener(new OnInfoWindowClickListener(){
@Override
public void onInfoWindowClick(Marker adminmarker){
Intent intent = new Intent(MainActivity.this,AdminActivity.class);
startActivity(intent);
}
});
and in you AdminActivity class just override OnCreateMethod and call onCreateDialog function from that (so your admin activity has two method onCreateDialog and onCreate).
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Dialog dialog=onCreateDialog(savedInstanceState)
dialog.show();
}