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:com.blueserial.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ActivityHelper.initialize(this);

    Intent intent = getIntent();//w  w w.j  a v a  2  s  .  c o  m
    Bundle b = intent.getExtras();
    mDevice = b.getParcelable(Homescreen.DEVICE_EXTRA);
    mDeviceUUID = UUID.fromString(b.getString(Homescreen.DEVICE_UUID));
    mMaxChars = b.getInt(Homescreen.BUFFER_SIZE);

    jsonParser = new JSONParser();
    url = "http://172.16.152.129/my_projects/android_database/add_sonar_data.php";

    Log.d(TAG, "Ready");

    mBtnDisconnect = (Button) findViewById(R.id.btnDisconnect);
    mBtnSend = (Button) findViewById(R.id.btnSend);
    mBtnClear = (Button) findViewById(R.id.btnClear);
    mTxtReceive = (TextView) findViewById(R.id.txtReceive);
    mEditSend = (EditText) findViewById(R.id.editSend);
    scrollView = (ScrollView) findViewById(R.id.viewScroll);
    chkScroll = (CheckBox) findViewById(R.id.chkScroll);
    chkReceiveText = (CheckBox) findViewById(R.id.chkReceiveText);
    mBtnClearInput = (Button) findViewById(R.id.btnClearInput);

    mTxtReceive.setMovementMethod(new ScrollingMovementMethod());

    mBtnDisconnect.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            mIsUserInitiatedDisconnect = true;
            new DisConnectBT().execute();
        }
    });

    mBtnSend.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            try {
                mBTSocket.getOutputStream().write(mEditSend.getText().toString().getBytes());
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    });

    mBtnClear.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            mEditSend.setText("");
        }
    });

    mBtnClearInput.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            mTxtReceive.setText("");
        }
    });

}

From source file:com.mb.android.playbackmediator.utils.Utils.java

/**
 * Builds and returns a {@link MediaInfo} that was wrapped in a {@link Bundle} by
 * <code>fromMediaInfo</code>.
 *
 * @param wrapper/*  w ww .  ja v  a  2s  . co  m*/
 * @return
 * @see <code>fromMediaInfo()</code>
 */
public static MediaInfo toMediaInfo(Bundle wrapper) {
    if (null == wrapper) {
        return null;
    }

    MediaMetadata metaData = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE);

    metaData.putString(MediaMetadata.KEY_SUBTITLE, wrapper.getString(MediaMetadata.KEY_SUBTITLE));
    metaData.putString(MediaMetadata.KEY_TITLE, wrapper.getString(MediaMetadata.KEY_TITLE));
    metaData.putString(MediaMetadata.KEY_STUDIO, wrapper.getString(MediaMetadata.KEY_STUDIO));
    ArrayList<String> images = wrapper.getStringArrayList(KEY_IMAGES);
    if (null != images && !images.isEmpty()) {
        for (String url : images) {
            Uri uri = Uri.parse(url);
            metaData.addImage(new WebImage(uri));
        }
    }
    String customDataStr = wrapper.getString(KEY_CUSTOM_DATA);
    JSONObject customData = null;
    if (!TextUtils.isEmpty(customDataStr)) {
        try {
            customData = new JSONObject(customDataStr);
        } catch (JSONException e) {
            LOGE(TAG, "Failed to deserialize the custom data string: custom data= " + customDataStr);
        }
    }
    return new MediaInfo.Builder(wrapper.getString(KEY_URL)).setStreamType(wrapper.getInt(KEY_STREAM_TYPE))
            .setContentType(wrapper.getString(KEY_CONTENT_TYPE)).setMetadata(metaData).setCustomData(customData)
            .setStreamDuration(wrapper.getLong(KEY_STREAM_DURATION)).build();
}

From source file:com.odoo.base.addons.mail.widget.MailChatterCompose.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.base_mail_chatter_message_compose);
    getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    getSupportActionBar().hide();/*  www. j  a v  a2s .c  o m*/
    fileManager = new OFileManager(this);
    Bundle extra = getIntent().getExtras();
    mType = MessageType.valueOf(extra.getString("type"));
    mModel = OModel.get(this, extra.getString("model"), null);
    irAttachment = new IrAttachment(this, null);
    mailMessage = new MailMessage(this, null);
    server_id = extra.getInt("server_id");
    if (mModel.getModelName().equals("res.partner")) {
        partner_id = server_id;
    } else {
        ODataRow row = mModel.browse(mModel.selectRowId(server_id));
        for (OColumn col : mModel.getColumns(false)) {
            if (col.getType().isAssignableFrom(ResPartner.class)) {
                if (col.getRelationType() != null && col.getRelationType() == OColumn.RelationType.ManyToOne) {
                    ODataRow partner = null;
                    if (!row.getString(col.getName()).equals("false")) {
                        partner = row.getM2ORecord(col.getName()).browse();
                    }
                    if (partner != null && partner.getInt("id") != 0) {
                        partner_id = partner.getInt("id");
                    }
                }
            }
        }
    }
    findViewById(R.id.btnAttachment).setOnClickListener(this);
    findViewById(R.id.btnSend).setOnClickListener(this);
    findViewById(R.id.btnCancel).setOnClickListener(this);
    edtSubject = (EditText) findViewById(R.id.messageSubject);
    edtBody = (EditText) findViewById(R.id.messageBody);
    horizontalScrollView = (LinearLayout) findViewById(R.id.attachmentsList);
    init();
}

From source file:com.cssweb.android.quote.FenLei.java

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

    HandlerThread mHandlerThread = new HandlerThread("CSSWEB_THREAD");
    mHandlerThread.start();/* ww w . j av  a2 s.  c  o m*/
    mHandler = new MessageHandler(mHandlerThread.getLooper());

    Bundle bundle = getIntent().getExtras();
    this.requestType = bundle.getInt("requestType");
    this.activityKind = Global.QUOTE_FENLEI;
    requestParams = new RequestParams();
    requestParams.setMarket("SHSZA");
    requestParams.setPaixu("zqdm");
    setContentView(R.layout.zr_table);

    String[] toolbarname = new String[] { Global.TOOLBAR_MENU, Global.TOOLBAR_PINGZHONG, Global.TOOLBAR_PAIXU,
            Global.TOOLBAR_SHANGYE, Global.TOOLBAR_XIAYIYE, Global.TOOLBAR_REFRESH };

    initTitle(R.drawable.njzq_title_left_back, 0, "");
    initToolBar(toolbarname, Global.BAR_TAG);

    cols = getResources().getStringArray(R.array.stock_cols);

    menu = getResources().getStringArray(R.array.stock_type_menu);
    paiming = getResources().getStringArray(R.array.zqpm_menu);
    desc = getResources().getStringArray(R.array.stock_desc);
    //A
    title1 = menu[6];
    //title2 = paiming[0];

    //????
    allStockNums = StockInfo.getStockInfoSize(stocktype);
    pageNum = CssSystem.getTablePageSize(FenLei.this);
    rowHeight = CssSystem.getTableRowHeight(FenLei.this);
    openOption();

    openPopup();

    requestParams.setBegin("1");
    requestParams.setEnd(String.valueOf(pageNum));
    setToolBar(3, false, R.color.zr_newlightgray);

    init(2);
}

From source file:air.com.snagfilms.cast.chromecast.utils.Utils.java

/**
 * Builds and returns a {@link MediaInfo} that was wrapped in a
 * {@link Bundle} by <code>fromMediaInfo</code>.
 * //from   w ww.  j a  va2  s  . c o  m
 * @see <code>fromMediaInfo()</code>
 * @param wrapper
 * @return
 */
public static MediaInfo toMediaInfo(Bundle wrapper) {
    if (null == wrapper) {
        return null;
    }

    MediaMetadata metaData = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE);

    metaData.putString(MediaMetadata.KEY_SUBTITLE, wrapper.getString(MediaMetadata.KEY_SUBTITLE));
    metaData.putString(MediaMetadata.KEY_TITLE, wrapper.getString(MediaMetadata.KEY_TITLE));
    metaData.putString(MediaMetadata.KEY_STUDIO, wrapper.getString(MediaMetadata.KEY_STUDIO));
    ArrayList<String> images = wrapper.getStringArrayList(KEY_IMAGES);
    if (null != images && !images.isEmpty()) {
        for (String url : images) {
            Uri uri = Uri.parse(url);
            metaData.addImage(new WebImage(uri));
        }
    }
    String customDataStr = wrapper.getString(KEY_CUSTOM_DATA);
    JSONObject customData = null;
    if (!TextUtils.isEmpty(customDataStr)) {
        try {
            customData = new JSONObject(customDataStr);
        } catch (JSONException e) {
            Log.e(TAG, "Failed to deserialize the custom data string: custom data= " + customDataStr);
        }
    }
    return new MediaInfo.Builder(wrapper.getString(KEY_URL)).setStreamType(wrapper.getInt(KEY_STREAM_TYPE))
            .setContentType(wrapper.getString(KEY_CONTENT_TYPE)).setMetadata(metaData).setCustomData(customData)
            .build();
}

From source file:fr.cph.chicago.activity.StationActivity.java

@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    mStationId = savedInstanceState.getInt("stationId");
}

From source file:com.nokia.example.paymentoneapk.PaymentOneAPKActivity.java

private void getPurchases() {
    Log.d(TAG, "PaymentOneAPKActivity.getPurchases");

    new Thread(new Runnable() {
        @Override/*from w  w w.j  a v  a2 s .  c  o m*/
        public void run() {
            Bundle ownedItems = null;

            try {
                ownedItems = mService.getPurchases(API_VERSION, getPackageName(), "inapp", null);
            } catch (final RemoteException e) {
                Log.e(TAG, "got an exception", e);

                return;
            }

            final int response = ownedItems.getInt("RESPONSE_CODE");

            Log.d(TAG, "getPurchases response code = " + response);

            if (response != PaymentOneAPKUtils.RESULT_OK) {

                Log.e(TAG, String.format("response code = %d : %s", response, getErrorMessage(response)));

                return;
            }

            final ArrayList<String> ownedSkus = ownedItems.getStringArrayList("INAPP_PURCHASE_ITEM_LIST");

            for (final String ownedSku : ownedSkus) {
                Log.d(TAG, "ownedSku = " + ownedSku);
            }
        }
    }).start();
}

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

private boolean loadPurchasesByType(String type, BillingCache cacheStorage) {
    if (!isInitialized())
        return false;
    try {//from w  ww  .  jav a 2 s .  co m
        Bundle bundle = billingService.getPurchases(Constants.GOOGLE_API_VERSION, contextPackageName, type,
                null);
        if (bundle.getInt(Constants.RESPONSE_CODE) == Constants.BILLING_RESPONSE_RESULT_OK) {
            cacheStorage.clear();
            ArrayList<String> purchaseList = bundle.getStringArrayList(Constants.INAPP_PURCHASE_DATA_LIST);
            ArrayList<String> signatureList = bundle.getStringArrayList(Constants.INAPP_DATA_SIGNATURE_LIST);
            if (purchaseList != null)
                for (int i = 0; i < purchaseList.size(); i++) {
                    String jsonData = purchaseList.get(i);

                    if (!TextUtils.isEmpty(jsonData)) {
                        JSONObject purchase = new JSONObject(jsonData);
                        String signature = signatureList != null && signatureList.size() > i
                                ? signatureList.get(i)
                                : null;
                        cacheStorage.put(purchase.getString(Constants.RESPONSE_PRODUCT_ID), jsonData,
                                signature);
                    }
                }
        }
        return true;
    } catch (Exception e) {
        if (eventHandler != null)
            eventHandler.onBillingError(Constants.BILLING_ERROR_FAILED_LOAD_PURCHASES, e);
        Log.e(LOG_TAG, "Error in loadPurchasesByType", e);
    }
    return false;
}

From source file:cn.laojing.smarthome.VoiceActivity.java

@Override
public void onEvent(int eventType, Bundle params) {
    switch (eventType) {
    case EVENT_ERROR:
        String reason = params.get("reason") + "";
        print("EVENT_ERROR, " + reason);
        break;/*from  w  w  w . ja v  a2s  .  c  o m*/
    case VoiceRecognitionService.EVENT_ENGINE_SWITCH:
        int type = params.getInt("engine_type");
        print("*?" + (type == 0 ? "" : ""));
        break;
    }
}

From source file:com.nokia.example.paymentoneapk.PaymentOneAPKActivity.java

private void queryProductDetails() {
    Log.d(TAG, "PaymentOneAPKActivity.queryProductDetails");

    final Bundle querySkus = new Bundle();

    querySkus.putStringArrayList("ITEM_ID_LIST", productSkus);

    new Thread(new Runnable() {
        @SuppressWarnings("CollectionDeclaredAsConcreteClass")
        @Override/*from w w  w .  ja  v  a 2s. c  o m*/
        public void run() {

            final Bundle skuDetails;
            try {

                skuDetails = mService.getSkuDetails(API_VERSION, getPackageName(), "inapp", querySkus);

            } catch (final RemoteException e) {
                Log.e(TAG, "query error", e);
                return;
            }

            final int response = skuDetails.getInt("RESPONSE_CODE");
            Log.d(TAG, String.format("response = %d", response));

            if (response != PaymentOneAPKUtils.RESULT_OK) {

                toastMessage(
                        String.format("Got invalid response while doing query: %s", getErrorMessage(response)));

                return;
            }

            final ArrayList<String> responseList = skuDetails.getStringArrayList("DETAILS_LIST");

            for (final String resp : responseList) {
                Log.d(TAG, String.format("resp = %s", resp));
            }

            toastMessage("Item query done");

        }
    }).start();
}