Example usage for android.os Bundle putInt

List of usage examples for android.os Bundle putInt

Introduction

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

Prototype

public void putInt(@Nullable String key, int value) 

Source Link

Document

Inserts an int value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:com.mikecorrigan.trainscorekeeper.FragmentHistory.java

public static FragmentHistory newInstance(int index, JSONObject jsonSpec) {
    Log.vc(VERBOSE, TAG, "newInstance: jsonTab=" + jsonSpec);

    FragmentHistory fragment = new FragmentHistory();
    Bundle args = new Bundle();
    args.putInt(ARG_INDEX, index);
    args.putString(ARG_TAB_SPEC, jsonSpec.toString());
    fragment.setArguments(args);//from   www. j  a  v  a2s .  co m
    return fragment;
}

From source file:com.chess.genesis.data.GameParser.java

public static Bundle parse(final JSONObject data) {
    final Bundle game = new Bundle();

    try {/*from w ww.  ja v a  2  s  . c om*/
        game.putInt("gametype", Enums.GameType(data.optString("gametype", "genesis")));
    } catch (final RuntimeException e) {
        game.putInt("gametype", Enums.GENESIS_CHESS);
    }
    try {
        game.putInt("opponent", Enums.OpponentType(data.optString("opponent", "human")));
    } catch (final RuntimeException e) {
        game.putInt("opponent", Enums.HUMAN_OPPONENT);
    }

    game.putString("name", data.optString("name", "untitled"));
    game.putLong("ctime", data.optLong("ctime", System.currentTimeMillis()));
    game.putLong("stime", data.optLong("stime", System.currentTimeMillis()));

    final GamePosition pos = parsePosition(data.optString("history", " "), game.getInt("gametype"));
    game.putString("history", pos.history);
    game.putString("zfen", pos.zfen);

    return game;
}

From source file:fr.cph.chicago.fragment.BusFragment.java

/**
 * Returns a new instance of this fragment for the given section number.
 * //  w w  w .j a  va  2  s .com
 * @param sectionNumber
 *            the section number
 * @return the fragment
 */
public static BusFragment newInstance(final int sectionNumber) {
    BusFragment fragment = new BusFragment();
    Bundle args = new Bundle();
    args.putInt(ARG_SECTION_NUMBER, sectionNumber);
    fragment.setArguments(args);
    return fragment;
}

From source file:fr.cph.chicago.core.fragment.BusFragment.java

/**
 * Returns a new instance of this fragment for the given section number.
 *
 * @param sectionNumber the section number
 * @return the fragment/* w w w . j a va  2s  . com*/
 */
@NonNull
public static BusFragment newInstance(final int sectionNumber) {
    final BusFragment fragment = new BusFragment();
    final Bundle args = new Bundle();
    args.putInt(ARG_SECTION_NUMBER, sectionNumber);
    fragment.setArguments(args);
    return fragment;
}

From source file:org.alfresco.mobile.android.platform.exception.CloudExceptionUtils.java

public static void handleCloudException(Context context, Long accountId, Exception exception,
        boolean forceRefresh, String taskId) {
    Log.w(TAG, Log.getStackTraceString(exception));
    if (exception instanceof AlfrescoSessionException) {
        AlfrescoSessionException ex = ((AlfrescoSessionException) exception);
        switch (ex.getErrorCode()) {
        case ErrorCodeRegistry.SESSION_API_KEYS_INVALID:
        case ErrorCodeRegistry.SESSION_REFRESH_TOKEN_EXPIRED:
            requestOAuthAuthentication(context, accountId, taskId, forceRefresh);
            return;
        default://w  w w  . j av a 2 s .  com
            if (ex.getMessage().contains("No authentication challenges found") || ex.getErrorCode() == 100) {
                requestOAuthAuthentication(context, accountId, taskId, forceRefresh);
                return;
            }
            break;
        }
    }

    if (exception instanceof AlfrescoServiceException) {
        AlfrescoServiceException ex = ((AlfrescoServiceException) exception);
        if ((ex.getErrorCode() == 104 || (ex.getMessage() != null
                && ex.getMessage().contains("No authentication challenges found")))) {
            requestOAuthAuthentication(context, accountId, taskId, forceRefresh);
            return;
        } else {
            Bundle b = new Bundle();
            b.putInt(SimpleAlertDialogFragment.ARGUMENT_ICON, R.drawable.ic_application_logo);
            b.putInt(SimpleAlertDialogFragment.ARGUMENT_TITLE, R.string.error_general_title);
            b.putInt(SimpleAlertDialogFragment.ARGUMENT_POSITIVE_BUTTON, android.R.string.ok);
            b.putInt(SimpleAlertDialogFragment.ARGUMENT_MESSAGE,
                    AlfrescoExceptionHelper.getMessageId(context, exception));
            BaseActionUtils.actionDisplayDialog(context, b);
            return;
        }
    }

    if (exception instanceof CmisConnectionException) {
        CmisConnectionException ex = ((CmisConnectionException) exception);
        if (ex.getMessage().contains("No authentication challenges found")) {
            requestOAuthAuthentication(context, accountId, taskId, forceRefresh);
            return;
        }
    }

    if (exception instanceof AlfrescoSessionException) {
        int messageId = R.string.error_session_notfound;
        AlfrescoSessionException se = ((AlfrescoSessionException) exception);
        if (se.getErrorCode() == ErrorCodeRegistry.GENERAL_HTTP_RESP && se.getMessage() != null
                && se.getMessage().contains(HttpStatus.SC_SERVICE_UNAVAILABLE + "")) {
            messageId = R.string.error_session_cloud_unavailable;
        }

        EventBusManager.getInstance().post(new LoadAccountErrorEvent(null, accountId, exception, messageId));
    }
}

From source file:Main.java

public static void goToActivity(Context packageContext, Class<?> targetActivityClass, String paraName,
        Object paramValue) {// w w w. j a  v  a2  s.c  om
    Intent intent = new Intent();
    intent.setClass(packageContext, targetActivityClass);
    Bundle bundle = new Bundle();
    if (paramValue instanceof String) {
        bundle.putString(paraName, (String) paramValue);
    } else {
        bundle.putInt(paraName, (int) paramValue);
    }
    intent.putExtras(bundle);
    packageContext.startActivity(intent);
}

From source file:com.mikecorrigan.trainscorekeeper.FragmentButton.java

public static FragmentButton newInstance(int index, JSONObject jsonTab) {
    Log.vc(VERBOSE, TAG, "newInstance: jsonTab=" + jsonTab);

    FragmentButton fragment = new FragmentButton();
    Bundle args = new Bundle();
    args.putInt(ARG_INDEX, index);
    args.putString(ARG_TAB_SPEC, jsonTab.toString());
    fragment.setArguments(args);//from  ww  w.  ja va2 s.c o m
    return fragment;
}

From source file:fr.cph.chicago.core.fragment.BikeFragment.java

/**
 * Returns a new instance of this fragment for the given section number.
 *
 * @param sectionNumber the section number
 * @return the fragment/*from www .java  2  s. co m*/
 */
@NonNull
public static BikeFragment newInstance(final int sectionNumber) {
    final BikeFragment fragment = new BikeFragment();
    final Bundle args = new Bundle();
    args.putInt(ARG_SECTION_NUMBER, sectionNumber);
    fragment.setArguments(args);
    return fragment;
}

From source file:com.ronnyml.sweetplayer.fragments.CommonFragment.java

public static CommonFragment newInstance(int position, String screen) {
    CommonFragment fragment = new CommonFragment();
    Bundle args = new Bundle();
    args.putInt(Constants.POSITION, position);
    args.putString(Constants.SCREEN, screen);
    fragment.setArguments(args);//  ww  w.j  a  v  a  2s.c o  m
    return fragment;
}

From source file:gov.in.bloomington.georeporter.fragments.SavedReportViewFragment.java

public static SavedReportViewFragment newInstance(int position) {
    SavedReportViewFragment fragment = new SavedReportViewFragment();
    Bundle args = new Bundle();
    args.putInt(POSITION, position);
    fragment.setArguments(args);//from  w  ww.j  a v a  2  s  .  com
    return fragment;
}