How to call a method that is inside my fragment by java through the onclick of a button contained in the same fragment? Here is the code:
public class FragmentMinet extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
View view = inflater.inflate(R.layout.layout_fragment_minhaconta, null);
Button botao = (Button) view.findViewById(R.id.editarMinhasInformacoes);
return (view);
}
public void clicar(View v){
mostrarMsg("Titulo teste", "Mensagem teste");
}
public void mostrarMsg(String titulo, String mensagem) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setCancelable(true);
builder.setTitle(titulo);
builder.setMessage(mensagem);
builder.show();
}
}