Example usage for android.os TransactionTooLargeException TransactionTooLargeException

List of usage examples for android.os TransactionTooLargeException TransactionTooLargeException

Introduction

In this page you can find the example usage for android.os TransactionTooLargeException TransactionTooLargeException.

Prototype

public TransactionTooLargeException() 

Source Link

Usage

From source file:devfigas.com.neverlargeexception.IntentTransporter.java

public static void startActivity(AppCompatActivity from, SuperIntent superIntent) {
    switch (superIntent.mIntentCofiguration.getTransportMode()) {
    case IntentCofiguration.NEVER:
        from.startActivity(superIntent);//only transport using traditional mode
        break;/*from ww w. j av a2  s  . co  m*/
    case IntentCofiguration.EVER:
        IntentTransporter.startActivity(from, superIntent, null);//only transport using static attribute mode
        break;
    case IntentCofiguration.ACCORDING_SIZE:
        if (IntentCofiguration.sizeOf(superIntent.getBundle()) < superIntent.mIntentCofiguration
                .getLimitSize()) {
            from.startActivity(superIntent);//only transport using static attribute mode if len is validate
            break;
        }
        //case else, no break:go to IntentCofiguration.DEFAULT case
    case IntentCofiguration.DEFAULT:
        try {
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
                //force exception, because Android N- no call RuntimeException, but cant transport sucess
                throw new TransactionTooLargeException();
            } else
                from.startActivity(superIntent);
        } catch (RuntimeException e) {
            IntentTransporter.startActivity(from, superIntent, e);
        } catch (TransactionTooLargeException e) {
            IntentTransporter.startActivity(from, superIntent, null);
        }
        break;
    }

}

From source file:devfigas.com.neverlargeexception.IntentTransporter.java

public static void startActivity(Fragment from, SuperIntent superIntent) {
    switch (superIntent.mIntentCofiguration.getTransportMode()) {
    case IntentCofiguration.NEVER:
        from.startActivity(superIntent);//only transport using traditional mode
        break;//from ww  w.  j  av a  2  s.  c  o  m
    case IntentCofiguration.EVER:
        IntentTransporter.startActivity(from, superIntent, null);//only transport using static attribute mode
        break;
    case IntentCofiguration.ACCORDING_SIZE:
        if (IntentCofiguration.sizeOf(superIntent.getBundle()) < superIntent.mIntentCofiguration
                .getLimitSize()) {
            from.startActivity(superIntent);//only transport using static attribute mode if len is validate
            break;
        }
        //case else, no break:go to IntentCofiguration.DEFAULT case
    case IntentCofiguration.DEFAULT:
        try {
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
                //force exception, because Android N- no call RuntimeException, but cant transport sucess
                throw new TransactionTooLargeException();
            } else
                from.startActivity(superIntent);
        } catch (RuntimeException e) {
            IntentTransporter.startActivity(from, superIntent, e);
        } catch (TransactionTooLargeException e) {
            IntentTransporter.startActivity(from, superIntent, null);
        }
        break;
    }
}

From source file:devfigas.com.neverlargeexception.IntentTransporter.java

public static void startActivityForResult(Fragment from, SuperIntent superIntent, int requestCode) {
    switch (superIntent.mIntentCofiguration.getTransportMode()) {
    case IntentCofiguration.NEVER:
        from.startActivityForResult(superIntent, requestCode);//only transport using traditional mode
        break;//from  w ww. j  av  a 2 s  . co m
    case IntentCofiguration.EVER:
        IntentTransporter.startActivity(from, superIntent, null);//only transport using static attribute mode
        break;
    case IntentCofiguration.ACCORDING_SIZE:
        if (IntentCofiguration.sizeOf(superIntent.getBundle()) < superIntent.mIntentCofiguration
                .getLimitSize()) {
            from.startActivityForResult(superIntent, requestCode);//only transport using static attribute mode if len is validate
            break;
        }
        //case else, no break:go to IntentCofiguration.DEFAULT case
    case IntentCofiguration.DEFAULT:
        try {
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
                //force exception, because Android N- no call RuntimeException, but cant transport sucess
                throw new TransactionTooLargeException();
            } else
                from.startActivityForResult(superIntent, requestCode);
        } catch (RuntimeException e) {
            IntentTransporter.startActivityForResult(from, superIntent, e, requestCode);
        } catch (TransactionTooLargeException e) {
            IntentTransporter.startActivityForResult(from, superIntent, null, requestCode);
        }
        break;
    }
}

From source file:devfigas.com.neverlargeexception.IntentTransporter.java

public static void startActivityForResult(AppCompatActivity from, SuperIntent superIntent, int requestCode) {
    switch (superIntent.mIntentCofiguration.getTransportMode()) {
    case IntentCofiguration.NEVER:
        from.startActivityForResult(superIntent, requestCode);//only transport using traditional mode
        break;//from  ww  w.  ja v a2 s  . c  o m
    case IntentCofiguration.EVER:
        IntentTransporter.startActivity(from, superIntent, null);//only transport using static attribute mode
        break;
    case IntentCofiguration.ACCORDING_SIZE:
        if (IntentCofiguration.sizeOf(superIntent.getBundle()) < superIntent.mIntentCofiguration
                .getLimitSize()) {
            from.startActivityForResult(superIntent, requestCode);//only transport using static attribute mode if len is validate
            break;
        }
        //case else, no break:go to IntentCofiguration.DEFAULT case
    case IntentCofiguration.DEFAULT:
        try {
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
                //force exception, because Android N- no call RuntimeException, but cant transport sucess
                throw new TransactionTooLargeException();
            } else
                from.startActivityForResult(superIntent, requestCode);
        } catch (RuntimeException e) {
            IntentTransporter.startActivityForResult(from, superIntent, e, requestCode);
        } catch (TransactionTooLargeException e) {
            IntentTransporter.startActivityForResult(from, superIntent, null, requestCode);
        }
        break;
    }
}