How to make right or left or left to right transition between activities on sliding the screen

Adham picture Adham · Jul 14, 2012 · Viewed 7.9k times · Source

If I have three activities, I want to move from one activity to another when touching the moving on the screen horizontally(from left to right or right to left). how to access the action of sliding the screen and ?

Answer

Yogesh Somani picture Yogesh Somani · Jul 14, 2012

try this:

     try    {           
        Intent newIntent = new Intent(view.getContext(), NewActivity.class);    
        startActivityForResult(newIntent, 0);
        overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right);        
    } catch(Exception ex) {
    }