startActivity出错

时间:2011-06-20 16:51:49

标签: android android-activity

我不断收到此源代码的错误。有谁知道我做错了什么?

package com.fttech.da;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class mainMenu extends Activity {
    /** Called when the activity is first created. */


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
       final Intent intent =    new Intent(this, DorothyTalk.class);

        setContentView(R.layout.main_menu);
        Button talk = (Button)findViewById(R.id.talk);

        talk.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) { 

                startActivity(intent);

            }
        });

    }
}

每次点击按钮,我都会收到强制关闭错误。

这是第二个活动源代码。

package com.fttech.da;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;


public class DorothyTalk extends Activity{

    private TextView text1;
    private EditText edit;
    private Button respond;
    private String name;


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




    }   
}

1 个答案:

答案 0 :(得分:1)

你有类似的东西

吗?
<activity android:name=".DorothyTalk"></activity>
你的AndroidManifest.xml文件中的