Android studio不会向我返回任何错误,但是当我运行此代码模拟器时,我收到一条消息Unfortunately, the app has stopped
我正在使用OnClick和Intent连接android studio中的两个活动。我试图通过Logcat查找错误,但即使在那儿也没有任何错误。
第一页是std_home.java
,第二页是std_registration.java
public class std_home extends AppCompatActivity {
private Button b2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_std_home);
b2 = (Button) findViewById(R.id.std_sign_in);
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v){
startActivity(new Intent(std_home.this, std_registration.class));
}
});
public class std_registration extends AppCompatActivity {
TextView t;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_std_registration);
t = (TextView) findViewById(R.id.reg_title);
Typeface myCustomFont = Typeface.createFromAsset(getAssets(), "fonts/AdobeMing-Light.ttf");
t.setTypeface(myCustomFont);
}
}
预期结果是在单击按钮Sign in
之后,应用程序应打开注册表单,但消息为Unfortunately, the app has stopped
时将停止该过程。