Je cette findViewById()
apparemment innocent dans mon onCreate()
qui revient toujours null:Quand findViewById() renvoie-t-il une valeur nulle?
mCheckLicenseButton = (Button) findViewById(R.id.btn_checkout);
Mon res/layout/main.xml
clearnly contient ce bouton:
<Button android:id="@+id/btn_checkout"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/top_textview"
android:layout_alignParentRight="true"
android:text="Check License" />
Je ne comprends pas pourquoi findViewById()
renvoie NULL.
Dans quelles circonstances findViewById()
renvoie null?
De toute évidence, findViewById()
ne parvient pas à trouver la ressource de mise en page mais qu'est-ce qui pourrait expliquer cela?
et je suppose que le fichier main.xml est chargé? Aussi avez-vous plus d'une mise en page définie (pour le portrait/paysage par exemple) et si oui, est-ce défini dans les deux? – jkhouw1