imageButton1 = (ImageButton) findViewById(R.drawable.house_baretheon);
Notice how the method is called findViewById
, so you should ACTUALLY be supplying it the ID that you registered to the image button
You have to first set the content view of your activity
setContentView(R.layout.activity_main);
This will set the screen, and put all those buttons on there, AFTER you have made this call you need to grab a reference to all the imagebuttons.
layout/activity_main.xml
should have an imagebutton like this for all the items
<ImageButton
android:id="@+id/button_house_baretheon"
android:src="@drawable/house_baretheon"
... />
Then grab the reference by calling
imageButton1 = (ImageButton) findViewById(R.id.button_house_baretheon)
The rest of your code is fine.
Edit
Oh wait one more thing, you need to call show() after the makeText()
method call, so like this
Toast.makeText(MainActivity.this, R.string.baratheon, Toast.LENGTH_LONG).show();