I'm trying to make an app with different intents. I've got two of the ready. I want that a button in the 1st intent makes the 2nd intent to appear. The issue is that the button is always set to null and throws a NullPointerException when the app is run
My .java classes are:
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(vocabulario);
   //....
    Button buttonVocabulary = (Button) findViewById(R.id.buttonVocabulary);
    Button holaPlayerBtn = (Button) findViewById(R.id.holaPlayerBtn);
//...
    buttonVocabulary.setOnClickListener(new OnClickListener(){
        @Override
        public void onClick(View view)
        {
//Se abre un nuevo Intent con el primer botón
            try
            {
                {
                    Intent myIntent = new Intent(view.getContext(), Vocabulario.class);
                    startActivityForResult(myIntent, 0);}
            } catch (Exception e) {
                e.printStackTrace();
            }
        }});
My main.xml file is:
   <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <RelativeLayout
            android:id="@+id/adViewContainer"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_alignParentBottom="true"
            />
        <Button
            android:id="@+id/buttonVocabulary"
            android:text="@string/vocabulario"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:nestedScrollingEnabled="true" />
    </LinearLayout>
</LinearLayout>
In my AndroidManifest.xml there is an element that says:
<activity android:name=".Vocabulario"
        android:label="@string/vocabulario"/>
There's something I'm doing wrong. Could you help me with this issue? Thanks in advance.
 
     
     
    