Ich bin neu in Android Entwicklung und natürlich auf Fragmente.Was verwende ich anstelle von findViewById in onCreateView mit Fragment
ich habe den Code unten, und ich will findViewById in Fragmente verwenden, sondern weil sie an ist onCreateView es hat Fehler
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.activity_main,null);
x2=(Button)getView().findViewById (R.id.btnX2);
x2.setText(Html.fromHtml(getResources().getString(R.string.X2)));
showResult = (EditText)getView().findViewById(R.id.display);
}
Was ist der Fehler? – fractalwrench