I’m attempting to open my class Speak2 from my main activity with this snippet:
Intent i = new Intent("R.voice.Speak2");
startActivity(i);
This is the full code from the first activity:
public class recon extends Activity implements OnClickListener {
ListView lv;
static final int check = 2000;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.voice);
lv = (ListView) findViewById(R.id.lvVoiceReturn);
Button b = (Button) findViewById(R.id.bVoice);
b.setOnClickListener(this);
}
public void onClick(View v) {
Intent i = new Intent(recon.this, Speak2.class);
startActivity(i);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
}
}
My program is simple. The button appears from voice.xml layout and when pressed launches the class activity Speak2. Why does the second activity never show?
Try this way and make sure your
Activity Speak2is also defined in yourAndroidManifest.xml, otherwise you’re going to get an exception.Your
<application>tag inAndroidManifest.xmlshould look like this: