Submit
is null
because it is not part of activity_main.xml
When you call findViewById
inside an Activity
, it is going to look for a View
inside your Activity's layout.
try this instead :
Submit = (Button)loginDialog.findViewById(R.id.Submit);
Another thing : you use
android:layout_below="@+id/LoginTitle"
but what you want is probably
android:layout_below="@id/LoginTitle"
See this question about the difference between @id
and @+id
.