Example usage for android.app ActivityOptions makeCustomAnimation

List of usage examples for android.app ActivityOptions makeCustomAnimation

Introduction

In this page you can find the example usage for android.app ActivityOptions makeCustomAnimation.

Prototype

public static ActivityOptions makeCustomAnimation(Context context, int enterResId, int exitResId) 

Source Link

Document

Create an ActivityOptions specifying a custom animation to run when the activity is displayed.

Usage

From source file:samples.piggate.com.piggateCompleteExample.Activity_SingIn.java

public void backButton() {
    Intent slideactivity = new Intent(Activity_SingIn.this, Activity_Main.class);
    slideactivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
    Bundle bndlanimation = ActivityOptions
            .makeCustomAnimation(getApplicationContext(), R.anim.slidefromleft, R.anim.slidetoright).toBundle();
    startActivity(slideactivity, bndlanimation);
}

From source file:samples.piggate.com.piggateCompleteExample.Activity_SingUp.java

public void backButton() {
    Intent slideactivity = new Intent(Activity_SingUp.this, Activity_Main.class);
    slideactivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
    Bundle bndlanimation = ActivityOptions
            .makeCustomAnimation(getApplicationContext(), R.anim.slidefromleft, R.anim.slidetoright).toBundle();
    startActivity(slideactivity, bndlanimation);
}

From source file:samples.piggate.com.piggateCompleteExample.buyOfferActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_credit_card);

    //Set action bar fields
    getSupportActionBar().setTitle(PiggateUser.getEmail());
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);

    //Views//from   w w  w .j  av  a  2s  .com
    EditCardNumber = (EditText) findViewById(R.id.cardNumber);
    EditCVC = (EditText) findViewById(R.id.CVC);
    SpinnerYear = (Spinner) findViewById(R.id.spinerYear);
    SpinnerMonth = (Spinner) findViewById(R.id.spinerMonth);
    validate = (Button) findViewById(R.id.buttonValidate);
    buttonBuy = (Button) findViewById(R.id.buttonBuy);
    buttonCancel = (Button) findViewById(R.id.buttonCancel);
    headerLayout = (LinearLayout) findViewById(R.id.headerLayout);
    cardlayout = (LinearLayout) findViewById(R.id.cardlayout);
    buylayout = (LinearLayout) findViewById(R.id.buyLayout);
    image = (SmartImageView) findViewById(R.id.offerImage2);

    //Animations
    slidetoLeft = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slidetoleft);
    slidetoRight = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slidetoright);
    slidefromRight = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slidefromright);
    slidefromLeft = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slidefromleft);

    //Validation Error AlertDialog
    errorDialog = new AlertDialog.Builder(buyOfferActivity.this).create();
    errorDialog.setTitle("Validation error");
    errorDialog.setMessage("The credit card is not valid");
    errorDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });

    //Network Error AlertDialog
    networkDialog = new AlertDialog.Builder(this).create();
    networkDialog.setTitle("Network error");
    networkDialog.setMessage("Network is not working");
    networkDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });

    image.setImageUrl(getIntent().getExtras().getString("offerImgURL")); //Set the offer image from URL
    //(Provisional) set the default fields of the credit card
    EditCardNumber.setText("4242424242424242");
    EditCVC.setText("123");

    piggate = new Piggate(this); //Initialize Piggate Object

    //OnClick listener for the validate button
    validate.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            //Validate the credit card with Stripe
            if (checkInternetConnection() == true) {
                // Credit card for testing: ("4242-4242-4242-4242", 12, 2016, "123")
                if (piggate.validateCard(EditCardNumber.getText().toString(),
                        Integer.parseInt(SpinnerMonth.getSelectedItem().toString()),
                        Integer.parseInt(SpinnerYear.getSelectedItem().toString()),
                        EditCVC.getText().toString(), "pk_test_BN86VnxiMBHkZtzPmpykc56g", //Stripe test. Will be returned by requests in next release
                        buyOfferActivity.this, "Validating", "Wait while the credit card is validated")) {
                    openBuyLayout();
                } else
                    errorDialog.show();
            } else {
                networkDialog.show();
            }
        }
    });

    //OnClick listener for the buy button
    buttonBuy.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            //Do the buy request to the server
            RequestParams params = new RequestParams();
            //Get the latest credit card Stripe token, amount to pay, type of coin and ID
            params.put("stripeToken", piggate.get_creditCards().get(piggate.get_creditCards().size() - 1)
                    .getTokenID().toString());
            params.put("amount", getIntent().getExtras().getString("offerPrice"));
            params.put("offerID", getIntent().getExtras().getString("offerID"));
            params.put("currency", getIntent().getExtras().getString("offerCurrency"));

            //Loading payment ProgressDialog
            loadingDialog = ProgressDialog.show(v.getContext(), "Payment", "Wait while the payment is finished",
                    true);

            //Do the buy request to the server (The server do the payment with Stripe)
            piggate.RequestBuy(params).setListenerRequest(new Piggate.PiggateCallBack() {

                //onComplete method for JSONObject
                @Override
                public void onComplete(int statusCode, Header[] headers, String msg, JSONObject data) {
                    loadingDialog.dismiss();

                    //Go back to the offer list passing the offer attributes (to exchange)
                    Intent slideactivity = new Intent(buyOfferActivity.this, Activity_Logged.class);
                    slideactivity.putExtra("offerID", getIntent().getExtras().getString("offerID"));
                    slideactivity.putExtra("offerName", getIntent().getExtras().getString("offerName"));
                    slideactivity.putExtra("offerDescription",
                            getIntent().getExtras().getString("offerDescription"));
                    slideactivity.putExtra("payment", true);
                    slideactivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
                    Bundle bndlanimation = ActivityOptions.makeCustomAnimation(getApplicationContext(),
                            R.anim.slidefromleft, R.anim.slidetoright).toBundle();
                    startActivity(slideactivity, bndlanimation);
                }

                //onError method for JSONObject
                @Override
                public void onError(int statusCode, Header[] headers, String msg, JSONObject data) {

                    //Show an error and go back to the credit card
                    loadingDialog.dismiss();
                    //Go back to the offer list with the variable payment set to false (payment error)
                    Intent slideactivity = new Intent(buyOfferActivity.this, Activity_Logged.class);
                    slideactivity.putExtra("payment", false);
                    slideactivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
                    Bundle bndlanimation = ActivityOptions.makeCustomAnimation(getApplicationContext(),
                            R.anim.slidefromleft, R.anim.slidetoright).toBundle();
                    startActivity(slideactivity, bndlanimation);
                }

                //onComplete method for JSONArray
                @Override
                public void onComplete(int statusCode, Header[] headers, String msg, JSONArray data) {
                    loadingDialog.dismiss();

                    //Go back to the offer list passing the offer attributes (to exchange)
                    Intent slideactivity = new Intent(buyOfferActivity.this, Activity_Logged.class);
                    slideactivity.putExtra("offerID", getIntent().getExtras().getString("offerID"));
                    slideactivity.putExtra("offerName", getIntent().getExtras().getString("offerName"));
                    slideactivity.putExtra("offerDescription",
                            getIntent().getExtras().getString("offerDescription"));
                    slideactivity.putExtra("payment", true);
                    slideactivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
                    Bundle bndlanimation = ActivityOptions.makeCustomAnimation(getApplicationContext(),
                            R.anim.slidefromleft, R.anim.slidetoright).toBundle();
                    startActivity(slideactivity, bndlanimation);
                }

                //onError method for JSONArray (Show an error and go back to the credit card)
                @Override
                public void onError(int statusCode, Header[] headers, String msg, JSONArray data) {

                    //Show an error and go back to the credit card
                    loadingDialog.dismiss();
                    //Go back to the offer list with the variable payment set to false (payment error)
                    Intent slideactivity = new Intent(buyOfferActivity.this, Activity_Logged.class);
                    slideactivity.putExtra("payment", false);
                    slideactivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
                    Bundle bndlanimation = ActivityOptions.makeCustomAnimation(getApplicationContext(),
                            R.anim.slidefromleft, R.anim.slidetoright).toBundle();
                    startActivity(slideactivity, bndlanimation);
                }
            }).exec();
        }
    });

    //OnClick listener for the cancel button (Go back to the credit card)
    buttonCancel.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            closeBuyLayout();
        }
    });
}

From source file:poche.fm.potunes.ActionBarCastActivity.java

protected void createDrawer() {
    final PrimaryDrawerItem item1 = new PrimaryDrawerItem().withIdentifier(1)
            .withName(R.string.drawer_item_home);
    boolean allow_mobile = appPreferences.getBoolean("allow_mobile", false);
    boolean allow_mobile_download = appPreferences.getBoolean("allow_mobile_download", false);
    final SwitchDrawerItem item2 = new SwitchDrawerItem().withIdentifier(2).withChecked(allow_mobile)
            .withName(R.string.drawer_item_mobile_play).withOnCheckedChangeListener(onCheckedChangeListener);
    final SwitchDrawerItem item3 = new SwitchDrawerItem().withIdentifier(3).withChecked(allow_mobile_download)
            .withName(R.string.drawer_item_mobile_download)
            .withOnCheckedChangeListener(onCheckedChangeListener);
    final SwitchDrawerItem item4 = new SwitchDrawerItem().withIdentifier(4).withChecked(true)
            .withName(R.string.drawer_item_lock_screen).withOnCheckedChangeListener(onCheckedChangeListener);
    PrimaryDrawerItem item5 = new PrimaryDrawerItem().withIdentifier(5)
            .withName(R.string.drawer_item_check_update);

    AccountHeader headerResult = new AccountHeaderBuilder().withActivity(this)
            .withHeaderBackground(R.drawable.header)
            .addProfiles(new ProfileDrawerItem().withName("Purchas Raul").withEmail("me@poche.fm")
                    .withIcon(getResources().getDrawable(R.drawable.profile)))
            .withOnAccountHeaderListener(new AccountHeader.OnAccountHeaderListener() {
                @Override//  w  ww.j a  v  a2s.  c  om
                public boolean onProfileChanged(View view, IProfile profile, boolean currentProfile) {
                    return false;
                }
            }).build();

    result = new DrawerBuilder().withAccountHeader(headerResult).withActivity(this).withToolbar(mToolbar)
            .addDrawerItems(item1, new DividerDrawerItem(), item2, item3, item4, item5)
            .withOnDrawerListener(new Drawer.OnDrawerListener() {
                @Override
                public void onDrawerOpened(View drawerView) {
                    boolean allow_mobile = appPreferences.getBoolean("allow_mobile", false);
                    boolean allow_mobile_download = appPreferences.getBoolean("allow_mobile_download", false);
                    item2.withChecked(allow_mobile);
                    item3.withChecked(allow_mobile_download);
                    result.updateItem(item2);
                    result.updateItem(item3);
                    result.updateItem(item4);
                }

                @Override
                public void onDrawerClosed(View drawerView) {
                }

                @Override
                public void onDrawerSlide(View drawerView, float slideOffset) {
                }
            }).withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                @Override
                public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                    switch (position) {
                    case 1:
                        Bundle extras = ActivityOptions.makeCustomAnimation(ActionBarCastActivity.this,
                                R.anim.fade_in, R.anim.fade_out).toBundle();
                        startActivity(new Intent(ActionBarCastActivity.this, MainActivity.class), extras);
                        finish();
                        break;
                    // 
                    case 6:
                        Toast.makeText(getApplicationContext(), R.string.check_update, Toast.LENGTH_LONG)
                                .show();
                        UpdateUtil update = new UpdateUtil(ActionBarCastActivity.this);
                        update.checkUpdate(false);
                        break;
                    case 3:
                        //
                        boolean allow_mobile = appPreferences.getBoolean("allow_mobile", false);
                        appPreferences.put("allow_mobile", !allow_mobile);
                        break;
                    case 4:
                        //
                        boolean allow_mobile_download = appPreferences.getBoolean("allow_mobile_download",
                                false);
                        appPreferences.put("allow_mobile_download", !allow_mobile_download);
                        break;
                    case 5:
                        // ??
                        break;
                    default:
                        Toast.makeText(getApplicationContext(), R.string.not_available, Toast.LENGTH_SHORT)
                                .show();
                        break;
                    }
                    return false;
                }
            }).build();
    mDrawerToggle = new ActionBarDrawerToggle(this, result.getDrawerLayout(), mToolbar,
            R.string.open_content_drawer, R.string.close_content_drawer);
    mDrawerToggle.syncState();
}

From source file:io.indy.drone.activity.StrikeListActivity.java

/**
 * Callback method from {@link StrikeListFragment.Callbacks}
 * indicating that the item with the given ID was selected.
 *///from w w w  .j a  va2s . c o  m
@Override
public void onItemSelected(String id) {

    if (mTwoPane) {

        mStrikeId = id;

        // In two-pane mode, show the detail view in this activity by
        // adding or replacing the detail fragment using a
        // fragment transaction.

        /*
                    Bundle bundle = new Bundle();
                    bundle.putString(SQLDatabase.KEY_ID, id);
                    bundle.putString(SQLDatabase.REGION, mRegion);
                
                    StrikeDetailFragment fragment = new StrikeDetailFragment();
                    fragment.setArguments(bundle);
                    getSupportFragmentManager().beginTransaction()
            .replace(R.id.strike_detail_container, fragment)
            .commit();
        */
        mStrikeDetailFragment = new StrikeDetailFragment();

        Bundle bundle = new Bundle();
        bundle.putString(SQLDatabase.KEY_ID, id);
        bundle.putString(SQLDatabase.REGION, mRegion);
        bundle.putBoolean(StrikeDetailFragment.ALWAYS_FLEX_VIEW, true);
        mStrikeDetailFragment.setArguments(bundle);

        getSupportFragmentManager().beginTransaction()
                .replace(R.id.strike_detail_container, mStrikeDetailFragment).commit();

        showStrikeOnMap(id);
        // Fragment mapFragment = (getSupportFragmentManager().findFragmentById(R.id.map));
        // mStrikeMapHelper.showStrikeOnMap((SupportMapFragment) mapFragment, strike);

    } else {
        // In single-pane mode, simply start the detail activity
        // for the selected item ID.
        Intent detailIntent = new Intent(this, StrikeDetailActivity.class);
        detailIntent.putExtra(SQLDatabase.KEY_ID, id);
        detailIntent.putExtra(SQLDatabase.REGION, mRegion);

        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
            startActivity(detailIntent);
        } else {
            // The enter/exit animations for the two activities are specified by xml resources
            Bundle translateBundle = ActivityOptions
                    .makeCustomAnimation(StrikeListActivity.this, R.anim.slide_in_left, R.anim.slide_out_left)
                    .toBundle();

            startActivity(detailIntent, translateBundle);
        }

    }
}

From source file:com.iternox.piggate.samples.PiggateLogin.Activity_Logged.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    _piggate = new Piggate(this);
    _piggate.setListenerBeacon(new Piggate.PiggateBeaconCallback() {
        @Override//from   ww w .  j  a  v  a2 s .  co  m
        public void DeviceNotCompatible() {

        }

        @Override
        public void BluetoohNotConnect() {

        }

        @Override
        public void PreScanning() {
        }

        @Override
        public void onReady() {

        }

        @Override
        public void onErrorScanning() {

        }

        @Override
        public void GetNewBeacons(final ArrayList<PiggateBeacon> beacons) {
            addPendingBeacons(beacons);
        }

        @Override
        public void GetBeacons(final ArrayList<PiggateBeacon> beacons) {

        }
    });

    setContentView(R.layout.activity_logged);

    textEmail = (TextView) findViewById(R.id.nametext);
    viewContainer = findViewById(R.id.notificationbar);
    textNotification = (TextView) findViewById(R.id.notification_message);
    Button logout = (Button) findViewById(R.id.buttonlogout);
    final ImageButton return_button = (ImageButton) findViewById(R.id.return1);
    return_button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onBackPressed();
        }
    });
    textEmail.setText("Hi, " + PiggateUser.getEmail());
    logout.setOnClickListener(new View.OnClickListener() {
        @Override
        synchronized public void onClick(View v) {
            if (!handledClick) {
                handledClick = true;
                Intent slideactivity = new Intent(Activity_Logged.this, Activity_Main.class);
                slideactivity.putExtra("ACTIVITY_MAIN_CREATED_BY_BUTTON_LOGOUT", true);

                Bundle bndlanimation = ActivityOptions
                        .makeCustomAnimation(getApplicationContext(), R.anim.flip1, R.anim.flip2).toBundle();
                startActivity(slideactivity, bndlanimation);

                if (checkInternetConnection() == true) {
                    _piggate.RequestCloseSession().setListenerRequest(new Piggate.PiggateCallBack() {
                        @Override
                        public void onComplete(int statusCode, Header[] headers, String msg, JSONObject data) {
                            Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();

                        }

                        @Override
                        public void onError(int statusCode, Header[] headers, String msg, JSONObject data) {
                            Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
                            _piggate.reload();
                        }

                        @Override
                        public void onComplete(int statusCode, Header[] headers, String msg, JSONArray data) {

                        }

                        @Override
                        public void onError(int statusCode, Header[] headers, String msg, JSONArray data) {

                        }
                    }).exec();

                } else {
                    Toast.makeText(getApplicationContext(), "Network is not working", Toast.LENGTH_LONG).show();
                }
            }
        }
    });

}

From source file:samples.piggate.com.piggateCompleteExample.Activity_Logged.java

public void logout() {

    if (checkInternetConnection() == true) { //If the internet connection is working

        loadingDialog = ProgressDialog.show(this, "Singing Out", "Wait a few seconds", false);

        //Request a session close for the logged user
        _piggate.RequestCloseSession().setListenerRequest(new Piggate.PiggateCallBack() {

            //Method onComplete for JSONObject
            @Override// ww w  .  ja  v a  2  s  .co m
            public void onComplete(int statusCode, Header[] headers, String msg, JSONObject data) {

                loadingDialog.dismiss();
                Service_Notify.logout = true;

                //Go back to the main activity
                Intent slideactivity = new Intent(Activity_Logged.this, Activity_Main.class);
                slideactivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
                Bundle bndlanimation = ActivityOptions
                        .makeCustomAnimation(getApplicationContext(), R.anim.slidefromleft, R.anim.slidetoright)
                        .toBundle();
                startActivity(slideactivity, bndlanimation);
            }

            //Method onError for JSONObject
            @Override
            public void onError(int statusCode, Header[] headers, String msg, JSONObject data) {
                Service_Notify.logout = false;
                loadingDialog.dismiss();
                errorDialog.show();
                _piggate.reload();
            }

            //Method onComplete for JSONArray
            @Override
            public void onComplete(int statusCode, Header[] headers, String msg, JSONArray data) {
                //Unused
            }

            //Method onError for JSONArray
            @Override
            public void onError(int statusCode, Header[] headers, String msg, JSONArray data) {
                //Unused
            }
        }).exec();

    } else { //If internet conexion is not working displays an error message
        networkErrorDialog.show();
    }
}

From source file:samples.piggate.com.piggateCompleteExample.buyOfferActivity.java

public void backButton() {
    Intent slideactivity = new Intent(buyOfferActivity.this, Activity_Logged.class);
    slideactivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
    Bundle bndlanimation = ActivityOptions
            .makeCustomAnimation(getApplicationContext(), R.anim.slidefromleft, R.anim.slidetoright).toBundle();
    startActivity(slideactivity, bndlanimation);
}

From source file:com.abhijitvalluri.android.fitnotifications.setup.AppIntroActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    LAUNCH_ACTIVITY_ANIM_BUNDLE = ActivityOptions
            .makeCustomAnimation(AppIntroActivity.this, R.transition.left_in, R.transition.left_out).toBundle();
    mPackageManager = getPackageManager();

    // Introduction slide
    addIntroSlide();//from w  w  w .ja  va  2s  .c  om

    // Fitbit install slide
    addFitbitInstallSlide();

    // Enable notifications slide
    addEnableNotificationAccessSlide();

    // Fitbit setup - 3 steps (3 slides)
    // Step 1
    addSlide(new SimpleSlide.Builder().layout(R.layout.fragment_intro).title(R.string.intro_setup_fitbit_title1)
            .description(R.string.intro_setup_fitbit_desc1).image(R.drawable.step_one)
            .background(R.color.fitbitColor_intro).backgroundDark(R.color.fitbitColorDark_intro)
            .buttonCtaLabel(R.string.intro_setup_fitbit_toast_button)
            .buttonCtaClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Toast.makeText(AppIntroActivity.this, getString(R.string.intro_setup_fitbit_toast_text1),
                            Toast.LENGTH_LONG).show();
                }
            }).build());

    // Step 2
    addSlide(new SimpleSlide.Builder().layout(R.layout.fragment_intro).title(R.string.intro_setup_fitbit_title2)
            .description(R.string.intro_setup_fitbit_desc2).image(R.drawable.step_two)
            .background(R.color.fitbitColor_intro).backgroundDark(R.color.fitbitColorDark_intro).build());

    // Step 3
    mLaunchFitbitSlide = createLaunchFitbitSlide();
    addSlide(mLaunchFitbitSlide);

    // App Choices slide
    mAppChoicesSlide = createAppChoicesSlide();
    addSlide(mAppChoicesSlide);

    // Start service
    addStartServiceSlide();

    // Do not disturb mode announcement slide
    addDNDModeSlide();

    // Demo Slide
    addDemoSlide();

    setButtonBackVisible(true);
    setButtonBackFunction(BUTTON_BACK_FUNCTION_BACK);
    setButtonNextVisible(true);
    setButtonNextFunction(BUTTON_NEXT_FUNCTION_NEXT_FINISH);
}

From source file:com.misterpereira.android.kiteplayer.ui.ActionBarCastActivity.java

protected void reAuthenticate() {
    Intent i = new Intent(this, AuthActivity.class);
    Bundle extras = ActivityOptions.makeCustomAnimation(this, R.anim.fade_in, R.anim.fade_out).toBundle();
    startActivity(i, extras);//from   w  w w. j a  v  a 2  s .  c  o  m
    finish();
}