Example usage for android.os Bundle getInt

List of usage examples for android.os Bundle getInt

Introduction

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

Prototype

public int getInt(String key) 

Source Link

Document

Returns the value associated with the given key, or 0 if no mapping of the desired type exists for the given key.

Usage

From source file:org.hfoss.posit.android.functionplugin.reminder.SetReminder.java

/**
 * Called from FindActivity.onActivityResult(). Used to 
 * update the Find's View, specifically the date, lat, long,
 * and alarm icon fields./*from   ww w  .  j  a  va 2 s . c o  m*/
 * 
 * @param context, the calling Activity
 * @param find, the current Find
 * @param view, the FindActivity's content view
 * @param intent, the Intent that is passed to the menu activity
 */
public void onActivityResultCallback(Context context, Find find, View view, Intent intent) {
    Log.i(TAG, "onActivityResultCallbac");
    // Intent is NOT null, meaning it includes reminder
    // date and location information set by the user
    if (intent != null) {
        Bundle bundle = intent.getExtras();

        // Get date, longitude, and latitude
        String date = bundle.getString(Find.TIME);
        Double longitude = bundle.getDouble(Find.LONGITUDE);
        Double latitude = bundle.getDouble(Find.LATITUDE);

        TextView tv = (TextView) view.findViewById(R.id.isAdhocTextView);

        Integer is_adhoc = bundle.getInt(Find.IS_ADHOC);
        Log.i(TAG, "is_adhoc = " + is_adhoc);
        if (tv != null) {
            Log.i(TAG, "Setting isAdhocTextView to " + is_adhoc);
            tv.setText("" + is_adhoc);
        }

        // Display user specified longitude and latitude
        tv = (TextView) view.findViewById(R.id.longitudeValueTextView);
        tv.setText(String.valueOf(longitude));
        tv = (TextView) view.findViewById(R.id.latitudeValueTextView);
        tv.setText(String.valueOf(latitude));

        // Remove the old row that displays time and replace it
        // with a new row that include an alarm clock icon to
        // visually indicate this find has a reminder attached
        ViewGroup parent = (ViewGroup) view.findViewById(R.id.timeValueTextView).getParent();
        parent.removeAllViews();
        ImageView alarmIcon = new ImageView(context);
        alarmIcon.setImageResource(R.drawable.reminder_alarm);
        TableRow.LayoutParams lp1 = new TableRow.LayoutParams(30, 30);
        lp1.setMargins(0, 6, 80, 0);
        parent.addView(alarmIcon, lp1);
        TextView mCloneTimeTV = new TextView(context);
        mCloneTimeTV.setId(R.id.timeValueTextView);
        mCloneTimeTV.setText(date);
        mCloneTimeTV.setTextSize(12);
        TextView mTimeTV = (TextView) view.findViewById(R.id.timeValueTextView);
        mTimeTV = mCloneTimeTV;
        TableRow.LayoutParams lp2 = new TableRow.LayoutParams();
        lp2.setMargins(6, 6, 0, 0);
        parent.addView(mTimeTV, lp2);
    }
}

From source file:ir.aarani.bazaar.billing.BillingProcessor.java

private boolean purchase(Activity activity, List<String> oldProductIds, String productId, String purchaseType,
        String developerPayload) {
    if (!isInitialized() || TextUtils.isEmpty(productId) || TextUtils.isEmpty(purchaseType))
        return false;
    try {//from w ww .j a  va  2  s.  c  om
        String purchasePayload = purchaseType + ":" + productId;
        if (!purchaseType.equals(Constants.PRODUCT_TYPE_SUBSCRIPTION)) {
            purchasePayload += ":" + UUID.randomUUID().toString();
        }
        if (developerPayload != null) {
            purchasePayload += ":" + developerPayload;
        }
        savePurchasePayload(purchasePayload);
        Bundle bundle;
        if (oldProductIds != null && purchaseType.equals(Constants.PRODUCT_TYPE_SUBSCRIPTION))
            bundle = billingService.getBuyIntentToReplaceSkus(Constants.GOOGLE_API_SUBSCRIPTION_CHANGE_VERSION,
                    contextPackageName, oldProductIds, productId, purchaseType, purchasePayload);
        else
            bundle = billingService.getBuyIntent(Constants.GOOGLE_API_VERSION, contextPackageName, productId,
                    purchaseType, purchasePayload);

        if (bundle != null) {
            int response = bundle.getInt(Constants.RESPONSE_CODE);
            if (response == Constants.BILLING_RESPONSE_RESULT_OK) {
                PendingIntent pendingIntent = bundle.getParcelable(Constants.BUY_INTENT);
                if (activity != null && pendingIntent != null)
                    activity.startIntentSenderForResult(pendingIntent.getIntentSender(),
                            PURCHASE_FLOW_REQUEST_CODE, new Intent(), 0, 0, 0);
                else if (eventHandler != null)
                    eventHandler.onBillingError(Constants.BILLING_ERROR_LOST_CONTEXT, null);
            } else if (response == Constants.BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED) {
                if (!isPurchased(productId) && !isSubscribed(productId))
                    loadOwnedPurchasesFromGoogle();
                TransactionDetails details = getPurchaseTransactionDetails(productId);
                if (!checkMerchant(details)) {
                    Log.i(LOG_TAG, "Invalid or tampered merchant id!");
                    if (eventHandler != null)
                        eventHandler.onBillingError(Constants.BILLING_ERROR_INVALID_MERCHANT_ID, null);
                    return false;
                }
                if (eventHandler != null) {
                    if (details == null)
                        details = getSubscriptionTransactionDetails(productId);
                    eventHandler.onProductPurchased(productId, details);
                }
            } else if (eventHandler != null)
                eventHandler.onBillingError(Constants.BILLING_ERROR_FAILED_TO_INITIALIZE_PURCHASE, null);
        }
        return true;
    } catch (Exception e) {
        Log.e(LOG_TAG, "Error in purchase", e);
        if (eventHandler != null)
            eventHandler.onBillingError(Constants.BILLING_ERROR_OTHER_ERROR, e);
    }
    return false;
}

From source file:com.ibm.mobilefirstplatform.clientsdk.android.push.internal.MFPInternalPushMessage.java

public MFPInternalPushMessage(Intent intent) {

    Bundle info = intent.getExtras();
    MFPPushUtils.dumpIntent(intent);/*from w  w  w.  j av a2s .c  o m*/

    alert = info.getString(GCM_EXTRA_ALERT);
    url = info.getString(GCM_EXTRA_URL);
    payload = info.getString(GCM_EXTRA_PAYLOAD);
    sound = info.getString(GCM_EXTRA_SOUND);
    bridge = info.getBoolean(GCM_EXTRA_BRIDGE);
    priority = info.getString(GCM_EXTRA_PRIORITY);
    visibility = info.getString(GCM_EXTRA_VISIBILITY);
    redact = info.getString(GCM_EXTRA_REDACT);
    key = info.getString(GCM_EXTRA_KEY);
    category = info.getString(GCM_EXTRA_CATEGORY);
    gcmStyle = info.getString(GCM_EXTRA_STYLE);
    iconName = info.getString(GCM_EXTRA_ICONNAME);
    notificationId = info.getInt(GCM_EXTRA_NOTIFICATIONID);

    try {
        JSONObject towers = new JSONObject(payload);
        id = towers.getString(GCM_EXTRA_ID);
    } catch (JSONException e) {
        logger.error(
                "MFPInternalPushMessage: MFPInternalPushMessage() - Exception while parsing JSON, get id.  "
                        + e.toString());
    }
}

From source file:com.example.alvarpao.popularmovies.MovieGridFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    // Add the below line in order for this fragment to display and handle menu options.
    setHasOptionsMenu(true);//  www .ja  v  a  2  s .c om

    if (savedInstanceState != null) {
        //State needs to be restored for this activity, a rotation occurred
        if (savedInstanceState.containsKey(LOADED_MOVIES))
            mMovies = savedInstanceState.getParcelableArrayList(LOADED_MOVIES);
        if (savedInstanceState.containsKey(PAGE_TO_FETCH))
            mPageToFetch = savedInstanceState.getInt(PAGE_TO_FETCH);
        if (savedInstanceState.containsKey(LOADED_PREVIOUS_ITEMS))
            mPreviousTotalItems = savedInstanceState.getInt(LOADED_PREVIOUS_ITEMS);
        if (savedInstanceState.containsKey(SELECTION_OCCURRED))
            mSelectionOccurred = savedInstanceState.getBoolean(SELECTION_OCCURRED);
        if (savedInstanceState.containsKey(CURRENT_SCROLL_POSITION))
            mCurrentScrollPosition = savedInstanceState.getInt(CURRENT_SCROLL_POSITION);
    }

    else
        mMovies = new ArrayList<Movie>();
}

From source file:com.zion.htf.ui.fragment.ArtistSoundcloudFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle args = this.getArguments();
    try {/*w  w w  . ja v a 2s  .c  o  m*/
        if (!args.containsKey(ArtistSoundcloudFragment.ARG_ARTIST_ID)
                && !args.containsKey(ArtistSoundcloudFragment.ARG_SET_ID))
            throw new MissingArgumentException(String.format(Locale.ENGLISH,
                    "Either %s or %s is required for this Activity to work properly. Please provide any of them.",
                    ArtistDetailsFragment.ARG_SET_ID, ArtistDetailsFragment.ARG_ARTIST_ID));
        if (args.containsKey(ArtistSoundcloudFragment.ARG_ARTIST_ID)) {
            this.artist = Artist.getById(args.getInt(ArtistSoundcloudFragment.ARG_ARTIST_ID));
        } else {
            this.artist = Artist.getBySetId(args.getInt(ArtistSoundcloudFragment.ARG_SET_ID));
        }
    } catch (Exception e) {
        //Report this through Piwik
        if (BuildConfig.DEBUG)
            e.printStackTrace();
        throw new RuntimeException(e);
    }
}

From source file:com.wellsandwhistles.android.redditsp.fragments.PostListingFragment.java

public PostListingFragment(final AppCompatActivity parent, final Bundle savedInstanceState, final Uri url,
        final UUID session, final boolean forceDownload) {

    super(parent, savedInstanceState);

    mPostListingManager = new PostListingManager(parent);

    if (savedInstanceState != null) {
        mPreviousFirstVisibleItemPosition = savedInstanceState.getInt(SAVEDSTATE_FIRST_VISIBLE_POS);
    }/* w w  w  .j ava 2s .c om*/

    try {
        mPostListingURL = (PostListingURL) RedditURLParser.parseProbablePostListing(url);
    } catch (ClassCastException e) {
        Toast.makeText(getActivity(), "Invalid post listing URL.", Toast.LENGTH_LONG).show();
        // TODO proper error handling -- show error view
        throw new RuntimeException("Invalid post listing URL");
    }

    mSession = session;

    final Context context = getContext();
    mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);

    // TODO output failed URL
    if (mPostListingURL == null) {
        mPostListingManager.addFooterError(new ErrorView(getActivity(),
                new SRError("Invalid post listing URL", "Could not navigate to that URL.")));
        // TODO proper error handling
        throw new RuntimeException("Invalid post listing URL");
    }

    switch (PrefsUtility.pref_behaviour_post_count(context, mSharedPreferences)) {
    case ALL:
        mPostCountLimit = -1;
        break;
    case R25:
        mPostCountLimit = 25;
        break;
    case R50:
        mPostCountLimit = 50;
        break;
    case R100:
        mPostCountLimit = 100;
        break;
    default:
        mPostCountLimit = 0;
        break;
    }

    if (mPostCountLimit > 0) {
        restackRefreshCount();
    }

    final ScrollbarRecyclerViewManager recyclerViewManager = new ScrollbarRecyclerViewManager(context, null,
            false);

    if (parent instanceof OptionsMenuUtility.OptionsMenuPostsListener
            && PrefsUtility.pref_behaviour_enable_swipe_refresh(context, mSharedPreferences)) {

        recyclerViewManager.enablePullToRefresh(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                ((OptionsMenuUtility.OptionsMenuPostsListener) parent).onRefreshPosts();
            }
        });
    }

    mRecyclerView = recyclerViewManager.getRecyclerView();
    mPostListingManager.setLayoutManager((LinearLayoutManager) mRecyclerView.getLayoutManager());

    mRecyclerView.setAdapter(mPostListingManager.getAdapter());

    mOuter = recyclerViewManager.getOuterView();

    mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(final RecyclerView recyclerView, final int dx, final int dy) {
            onLoadMoreItemsCheck();
        }
    });

    mRecyclerView.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT;

    final DownloadStrategy downloadStrategy;

    if (forceDownload) {
        downloadStrategy = DownloadStrategyAlways.INSTANCE;

    } else if (session == null && savedInstanceState == null && General.isNetworkConnected(context)) {

        final long maxAgeMs = PrefsUtility.pref_cache_rerequest_postlist_age_ms(context, mSharedPreferences);
        downloadStrategy = new DownloadStrategyIfTimestampOutsideBounds(TimestampBound.notOlderThan(maxAgeMs));

    } else {
        downloadStrategy = DownloadStrategyIfNotCached.INSTANCE;
    }

    mRequest = new PostListingRequest(mPostListingURL.generateJsonUri(),
            RedditAccountManager.getInstance(context).getDefaultAccount(), session, downloadStrategy, true);

    // The request doesn't go ahead until the header is in place.

    switch (mPostListingURL.pathType()) {

    case RedditURLParser.USER_POST_LISTING_URL:
    case RedditURLParser.SEARCH_POST_LISTING_URL:
    case RedditURLParser.MULTIREDDIT_POST_LISTING_URL:
        setHeader(mPostListingURL.humanReadableName(getActivity(), true), mPostListingURL.humanReadableUrl());
        CacheManager.getInstance(context).makeRequest(mRequest);
        break;

    case RedditURLParser.SUBREDDIT_POST_LISTING_URL:

        SubredditPostListURL subredditPostListURL = (SubredditPostListURL) mPostListingURL;

        switch (subredditPostListURL.type) {

        case FRONTPAGE:
        case ALL:
        case SUBREDDIT_COMBINATION:
        case ALL_SUBTRACTION:
        case POPULAR:
            setHeader(mPostListingURL.humanReadableName(getActivity(), true),
                    mPostListingURL.humanReadableUrl());
            CacheManager.getInstance(context).makeRequest(mRequest);
            break;

        case SUBREDDIT: {

            // Request the subreddit data

            final RequestResponseHandler<RedditSubreddit, SubredditRequestFailure> subredditHandler = new RequestResponseHandler<RedditSubreddit, SubredditRequestFailure>() {
                @Override
                public void onRequestFailed(SubredditRequestFailure failureReason) {
                    // Ignore
                    General.UI_THREAD_HANDLER.post(new Runnable() {
                        @Override
                        public void run() {
                            CacheManager.getInstance(context).makeRequest(mRequest);
                        }
                    });
                }

                @Override
                public void onRequestSuccess(final RedditSubreddit result, final long timeCached) {
                    General.UI_THREAD_HANDLER.post(new Runnable() {
                        @Override
                        public void run() {
                            mSubreddit = result;
                            onSubredditReceived();
                            CacheManager.getInstance(context).makeRequest(mRequest);
                        }
                    });
                }
            };

            try {
                RedditSubredditManager
                        .getInstance(getActivity(),
                                RedditAccountManager.getInstance(getActivity()).getDefaultAccount())
                        .getSubreddit(RedditSubreddit.getCanonicalName(subredditPostListURL.subreddit),
                                TimestampBound.NONE, subredditHandler, null);
            } catch (RedditSubreddit.InvalidSubredditNameException e) {
                throw new RuntimeException(e);
            }
            break;
        }
        }

        break;
    }
}

From source file:com.cssweb.android.trade.stock.StockTrading.java

@Override
public void onCreate(Bundle paramBundle) {
    super.onCreate(paramBundle);
    sc = new ServiceControl(this);//??
    ////w  w w. ja  va 2s  .com
    HandlerThread mHandlerThread = new HandlerThread("CSSWEB_THREAD");
    mHandlerThread.start();
    priceHandler = new PriceDataHandler(mHandlerThread.getLooper());

    setContentView(com.cssweb.android.main.R.layout.zr_trade_stock_trade);
    Bundle bundle = getIntent().getExtras();
    type = bundle.getInt("type");
    bsname = bundle.getString("bsname");
    String stockCode = bundle.getString("stkcode");

    initTitle(R.drawable.njzq_title_left_back, 0, bsname);

    LinearLayout localLinearLayout = (LinearLayout) findViewById(R.id.zrtradelayout);
    localLinearLayout.setOnFocusChangeListener(setOnEditFocusListener);
    this.m_vklayout = localLinearLayout;
    View localView1 = this.m_vklayout;
    localView1.setOnFocusChangeListener(setOnEditFocusListener);
    View localView2 = this.m_vklayout;
    localView2.setOnClickListener(setOnEditClickListener);

    viewFlipper = (ViewFlipper) this.findViewById(R.id.ViewFlipper01);
    preView = (ImageView) findViewById(R.id.previous_screen);

    leftIn = AnimationUtils.loadAnimation(this, R.anim.push_left_in_layout);
    leftOut = AnimationUtils.loadAnimation(this, R.anim.push_left_out_layout);
    rightIn = AnimationUtils.loadAnimation(this, R.anim.push_right_in_layout);
    rightOut = AnimationUtils.loadAnimation(this, R.anim.push_right_out_layout);

    priceView = (PriceMini) findViewById(R.id.zrviewprice);
    trendView = (TrendView) findViewById(R.id.zrviewtrend);
    trendView.setOnTouchListener(new View.OnTouchListener() {

        public boolean onTouch(View v, MotionEvent event) {
            return gestureDetector.onTouchEvent(event);
        }
    });
    klineView = (KlineMini) findViewById(R.id.zrviewkline);
    klineView.setOnTouchListener(new View.OnTouchListener() {

        public boolean onTouch(View v, MotionEvent event) {
            return gestureDetector.onTouchEvent(event);
        }
    });
    financeView = (FinanceMini) findViewById(R.id.zrviewfinance);

    stockHolder = (Spinner) findViewById(R.id.zrtxtaccount);
    queryMethod = (Spinner) findViewById(R.id.zrtxtbsflag);
    //      availableNum = (SeekBar) findViewById(R.id.zrcanbs);
    //      lblMaxNumber = (TextView)findViewById(R.id.txtMaxNumber);
    stkcode = (EditText) findViewById(R.id.zredtstockcode);
    stkname = (TextView) findViewById(R.id.zrtxtstockname);
    price = (EditText) findViewById(R.id.zredtprice);
    number = (EditText) findViewById(R.id.zredtcount);
    lblNumberUnit = (TextView) findViewById(R.id.lblNumberUnit);
    btn0 = (ShadowButton) findViewById(R.id.zr_surebutton);
    btn0.setOnClickListener(myShowProgreeBar);

    layoutprice0 = (LinearLayout) findViewById(R.id.LinearLayout03);
    layoutprice = (LinearLayout) findViewById(R.id.LinearLayout11);
    //layoutAvaiNumber = (LinearLayout)findViewById(R.id.LinearLayout04);
    //layoutAvaiAsset = (LinearLayout)findViewById(R.id.LinearLayout06);
    lblAvaiAsset = (TextView) findViewById(R.id.lblAvaiAsset);
    AvaiAsset = (TextView) findViewById(R.id.AvaiAsset);
    lblPrice = (TextView) findViewById(R.id.lblPrice);
    lblPrice1 = (TextView) findViewById(R.id.lblPrice1);
    lblNumber = (TextView) findViewById(R.id.lblNumber);
    avaiAsset = (TextView) findViewById(R.id.AvaiAsset);
    lblNumberUnit = (TextView) findViewById(R.id.lblNumberUnit);

    setDynamic();

    adjustDownPrice = (ImageView) findViewById(R.id.AdjustDownPrice);
    adjustDownPrice.setTag(0);
    adjustDownPrice.setOnClickListener(adjustIconListener);

    adjustUpPrice = (ImageView) findViewById(R.id.AdjustUpPrice);
    adjustUpPrice.setTag(1);
    adjustUpPrice.setOnClickListener(adjustIconListener);

    adjustDownNumber = (ImageView) findViewById(R.id.AdjustDownNumber);
    adjustDownNumber.setTag(2);
    adjustDownNumber.setOnClickListener(adjustIconListener);

    adjustUpNumber = (ImageView) findViewById(R.id.AdjustUpNumber);
    adjustUpNumber.setTag(3);
    adjustUpNumber.setOnClickListener(adjustIconListener);

    stkcode.setText(stockCode);
    if (stkcode.getText().length() == 6) {
        showProgress();
    }

    stkcode.setInputType(InputType.TYPE_NULL);
    stkcode.setFocusable(true);
    stkcode.setTag("STOCK");
    stkcode.setOnClickListener(setOnEditClickListener);
    stkcode.setOnFocusChangeListener(setOnEditFocusListener);

    price.setInputType(InputType.TYPE_NULL);
    price.setFocusable(true);
    price.setTag("NUMDOT");
    price.setOnClickListener(setOnEditClickListener);
    price.setOnFocusChangeListener(setOnEditFocusListener);

    number.setInputType(InputType.TYPE_NULL);
    number.setFocusable(true);
    number.setTag("");
    number.setOnClickListener(setOnEditClickListener);
    number.setOnFocusChangeListener(setOnEditFocusListener);

    stkcode.addTextChangedListener(new TextWatcher() {

        public void afterTextChanged(Editable arg0) {
            //queryStock(queryCode.getText());
            OnTextChanged(arg0);
        }

        public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {

        }

        public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {

        }

    });

    holder = TradeUser.getInstance().getHolder();

    stockHolderAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,
            (String[]) holder.toArray(new String[holder.size()]));
    stockHolderAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    stockHolder.setAdapter(stockHolderAdapter);

    String[] arrayOfString = getResources().getStringArray(R.array.other_market_bs_methods);
    for (int i = 0; i < arrayOfString.length; i++) {
        Log.e("arrayOfString", arrayOfString[i]);
    }

    queryMethodAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, arrayOfString);
    queryMethodAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    queryMethod.setAdapter(queryMethodAdapter);
    queryMethod.setOnItemSelectedListener(new OnItemSelectedListener() {
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            if (position != 0) {
                layoutprice0.setVisibility(View.GONE);
                layoutprice.setVisibility(View.VISIBLE);
            } else {
                layoutprice0.setVisibility(View.VISIBLE);
                layoutprice.setVisibility(View.GONE);
            }
        }

        public void onNothingSelected(AdapterView<?> arg0) {

        }
    });

    int h = R.drawable.forminput;
    Resources localResources = getResources();
    Drawable localDrawable = null;
    localDrawable = localResources.getDrawable(h);
    int spinnerheight = localDrawable.getIntrinsicHeight() - 4;
    //      Log.e("<<<<<<<<<<<<<<<<<<<eeeeeeeeeeeeeeeeeeeeeeeeeee>>>>>>>>>>>>>>", String.valueOf(spinnerheight));
    LinearLayout.LayoutParams linearParams1 = (LinearLayout.LayoutParams) stockHolder.getLayoutParams();//?stockHolder?
    linearParams1.height = spinnerheight;//??
    stockHolder.setLayoutParams(linearParams1);

    LinearLayout.LayoutParams linearParams = (LinearLayout.LayoutParams) queryMethod.getLayoutParams();//?queryMethod?
    linearParams.height = spinnerheight;//??
    queryMethod.setLayoutParams(linearParams);
}

From source file:com.transistorsoft.cordova.bggeo.CDVBackgroundGeolocation.java

private void onGetCount(Bundle event) {
    int count = event.getInt("count");
    Log.i(TAG, "- Cordova plugin: getCount: " + count);

    for (CallbackContext callback : getCountCallbacks) {
        callback.success(count);//from  ww  w  . j a  va 2s .co m
    }
    getCountCallbacks.clear();
}

From source file:com.onebus.view.MainActivity.java

public void onEvent(int eventType, Bundle params) {
    switch (eventType) {
    case EVENT_ERROR:
        String reason = params.get("reason") + "";
        Toast.makeText(getApplicationContext(), "EVENT_ERROR, " + reason, Toast.LENGTH_SHORT).show();
        break;//from  w  ww .  jav a2s  .c  o m
    case VoiceRecognitionService.EVENT_ENGINE_SWITCH:
        int type = params.getInt("engine_type");
        Toast.makeText(getApplicationContext(), "*?" + (type == 0 ? "" : ""),
                Toast.LENGTH_SHORT).show();
        break;
    }
}