Skip to content Skip to sidebar Skip to footer

Moving From One Activity To Another In Android

The following if my code. Please tell me what I am doing wrong? package version.nitt; import android.app.Activity; import android.os.Bundle; import android.view.View; import

Solution 1:

lin.setOnClickListener(new OnClickListener()
{
    publicvoidonClick(View v)
    {

       Intent i = new Intent(versionActivity.this, secondActivity.class);     
       startActivity(i);
       finish(); //should use the finish if you need to preserve memory//other wise don't use it.
    }

});

SECOND STEP: AndroidManifest.xml

<activityandroid:name=".secondActivity"><intent-filter><actionandroid:name="android.intent.action.MAIN" /></intent-filter></activity>

Solution 2:

use this..simple way of moving one activity to another

publicvoidonClick(View arg0){

            Intent intent = newIntent(context, App2Activity.class);
                        startActivity(intent);   

        }

add in manifest.xml

Post a Comment for "Moving From One Activity To Another In Android"