Process: mple.myapplication, PID: 21144
java.lang.RuntimeException: Unable to start activity ComponentInfo{mple.myapplication/mple.myapplication.MainActivity}: java.lang.ClassCastException: com.gc.materialdesign.views.ButtonRectangle cannot be cast to android.widget.Button
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2318)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2396)
at android.app.ActivityThread.access$800(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:149)
at android.app.ActivityThread.main(ActivityThread.java:5257)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassCastException: com.gc.materialdesign.views.ButtonRectangle cannot be cast to android.widget.Button
at mple.myapplication.MainActivity.onCreate(MainActivity.java:25)
at android.app.Activity.performCreate(Activity.java:5411)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2270)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2396)
at android.app.ActivityThread.access$800(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:149)
at android.app.ActivityThread.main(ActivityThread.java:5257)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at dalvik.system.NativeStart.main(Native Method)
package mple.myapplication;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
public class MainActivity extends AppCompatActivity
{
private Button logBtn;
private EditText emailText;
private EditText passText;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
logBtn = (Button)findViewById(R.id.logBtn);
emailText = (EditText)findViewById(R.id.emailText);
passText = (EditText)findViewById(R.id.passText);
logBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (emailText.getText().toString().matches(""))
{
emailText.setError("Email field can't be empty");
}
if (passText.getText().toString().matches(""))
{
passText.setError("Pass field can't be empty");
}
else
{
final ProgressDialog progressDialog = new ProgressDialog(MainActivity.this,
R.layout.activity_main);
progressDialog.setIndeterminate(true);
progressDialog.setMessage("Authenticating...");
progressDialog.show();
}
}
});
}
}
com.gc.materialdesign.views.ButtonRectangle cannot be cast to android.widget.Button
at mple.myapplication.MainActivity.onCreate(MainActivity.java:25)
logBtn = (Button)findViewById(R.id.logBtn);
com.gc.materialdesign.views.ButtonRectangle
а вы его хотите загрузить в переменную типа обычный Button, естественно из-за не совместимости типов здесь проблема, раз в layout используете ButtonRectangle то и в Java тоже используйте ButtonRectangle, а лучше просто исправьте layout чтобы в нем не было таких "заморочек" и были обычные Button и т.д.