登录成功后,意图未打开

时间:2014-11-02 10:22:48

标签: android android-intent

我有问题,我的意图在成功登录后无法打开。它表明我的应用程序已停止工作。我无法弄清楚为什么?

// check if the Stored password matches with  Password entered by user
if(password.equals(storedPassword))
{
    Toast.makeText(HomeActivity.this, "Congrats: Login Successfull", Toast.LENGTH_LONG).show();
    dialog.dismiss();
    **Intent i = new Intent (getApplicationContext(), FirstInterface.class);
    startActivity(i); // HERE IS THE INTENT CODING
} else {
    Toast.makeText(HomeActivity.this,
                   "User Name or Password does not match", 
                   Toast.LENGTH_LONG).show();
}

我应该在FirstInterface.class中插入什么内容?

公共类FirstInterface扩展了Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

1 个答案:

答案 0 :(得分:0)

确保清单中出现FirstInterface,如下所示:

<activity
    android:name=".FirstInterface"
    android:label="@string/app_name" >
</activity>

并使用您的活动上下文启动新活动,如下所示:

Intent i = new Intent (HomeActivity.this, FirstInterface.class);
startActivity(i);