Error in startActivity
I keep getting an error with this source code. Does anyone know what im doing wrong?
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);
}
});
}
}
Every time i click the button i get a Force close error.
Here is the second activity source code.
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;
开发者_如何学Python
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.dorothyDialog);
}
}
do you have something like
<activity android:name=".DorothyTalk"></activity>
in your AndroidManifest.xml file?
精彩评论