Reputation: 79
I have run one activity from main. I want If button is pressed, kill this user interface and activate other user interface to do other jobs.Mainly ;
in onClick ( view temp)
switch( temp . getId () ) {
case R.id.button_validate:
// raise other vindow after killing current one
My other activity class name is renderman. How can I do ?
Upvotes: 2
Views: 159
Reputation: 5162
Where you want to start the activity put the code startActivity(new Intent(getApplicationContext(), Renderman.class))
Also in your manifest put the following
<activity
android:name=".Renderman"
>
</activity>
</application>
You should (but dont have to)capitalise the first letter of your class names
If you want to literally 'kill' your old activity, after you start the new activity with the code above out finish()
To stop the problem that you are having, do the following
@Override
public void onBackPressed(){
//nothing, because you do not want anything to happen when you press back
}
Upvotes: 0
Reputation: 6322
public void onClick(View v) {
// TODO Auto-generated method stub
switch(v.getId())
{
case R.id.button_validate:
Intent i=new Intent(this,renderman.class);
startActivity(i);
break;
//use multiple case(for multiple button) like this if you need
case R.id.exit_button:
finish(); //to kill current one
}
}
And add these lines in AndroidManifest.xml..
<activity
android:name=".renderman">
</activity>
Upvotes: 2
Reputation: 5587
Put this code:
startActivity(new Intent(this, renderman.class));
finish();
Upvotes: 1