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.openerp.MainActivity.java

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mDBTables = new ArrayList<String>();
    getActionBar().setIcon(R.drawable.ic_launcher);
    if (savedInstanceState != null) {
        mDrawerItemSelectedPosition = savedInstanceState.getInt("current_drawer_item");
    }/*from  w  w w  .  j  a v  a 2s  .  c  o  m*/
    mContext = this;
    mFragment = getSupportFragmentManager();
    if (findViewById(R.id.fragment_detail_container) != null) {
        findViewById(R.id.fragment_detail_container).setVisibility(View.GONE);
        mTwoPane = true;
    }
    init();

}

From source file:com.almarsoft.GroundhogReader.MessageActivity.java

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

    mContext = getApplicationContext();/* w  ww .j  a va  2  s  . c  o m*/
    setContentView(R.layout.message);

    // Config checker alert dialog
    mConfigAlert = new AlertDialog.Builder(this).create();
    mConfigAlert.setButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dlg, int sumthin) {
            startActivity(new Intent(MessageActivity.this, OptionsActivity.class));
        }
    });

    mPrefs = PreferenceManager.getDefaultSharedPreferences(this);

    mOfflineMode = mPrefs.getBoolean("offlineMode", true);

    Bundle extras = getIntent().getExtras();
    mMsgIndexInArray = extras.getInt("msgIndexInArray");
    mArticleNumbersArray = extras.getLongArray("articleNumbers");
    mGroup = extras.getString("group");

    mMainLayout = (LinearLayout) this.findViewById(R.id.main_message_layout);
    //mLayoutAuthor  = (LinearLayout) this.findViewById(R.id.layout_author);
    mLayoutSubject = (LinearLayout) this.findViewById(R.id.layout_subject);
    mLayoutDate = (LinearLayout) this.findViewById(R.id.layout_date);

    mAuthor = (TextView) this.findViewById(R.id.text_author);
    mHeart = (ImageView) this.findViewById(R.id.img_love);
    //mHeart.setVisibility(ImageView.INVISIBLE);
    mDate = (TextView) this.findViewById(R.id.text_date);
    mSubject = (TextView) this.findViewById(R.id.text_subject);
    mSubjectText = null;
    mLastSubject = null;

    mContent = (WebView) this.findViewById(R.id.text_content);
    mWebSettings = mContent.getSettings();
    mWebSettings.setDefaultTextEncodingName("utf-8");
    mWebSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
    mWebSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
    mWebSettings.setJavaScriptEnabled(false);
    mWebSettings.setRenderPriority(WebSettings.RenderPriority.HIGH);
    mWebSettings.setSupportZoom(false);
    this.setWebViewSizeFromPrefs(0);

    mScroll = (ScrollView) this.findViewById(R.id.textAreaScroller);

    // Conectar los botones next y prev (sumar/restar 1 a mMsgIndexInArray y
    // llamar a loadMessage();
    mButton_Prev = (ImageButton) this.findViewById(R.id.btn_prev);
    mButton_Prev.setOnClickListener(new OnClickListener() {

        public void onClick(View arg0) {
            if (mMsgIndexInArray > 0) {
                mMsgIndexInArray--;
                loadMessage();
            } else {
                Toast.makeText(MessageActivity.this, getString(R.string.at_first_message), Toast.LENGTH_SHORT)
                        .show();
            }

        }
    });

    mButton_Next = (ImageButton) this.findViewById(R.id.btn_next);
    mButton_Next.setOnClickListener(new OnClickListener() {
        public void onClick(View arg0) {
            if (mMsgIndexInArray + 1 < mArticleNumbersArray.length) {
                mMsgIndexInArray++;
                loadMessage();
            } else {
                Toast.makeText(MessageActivity.this, getString(R.string.no_more_messages), Toast.LENGTH_SHORT)
                        .show();
            }

        }
    });

    mButton_GoGroup = (ImageButton) this.findViewById(R.id.btn_gogroup);
    mButton_GoGroup.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            /*
             Intent intent_MsgList = new Intent(MessageActivity.this, MessageListActivity.class);
            intent_MsgList.putExtra("selectedGroup", mGroup);
            MessageActivity.this.startActivity(intent_MsgList);
            */
            MessageActivity.this.finish();
        }
    });

    mServerManager = new ServerManager(mContext);

    loadMessage();

    mButton_Prev.setFocusable(false);
    mButton_Next.setFocusable(false);
    mContent.requestFocus();
}

From source file:com.nextgis.firereporter.GetFiresService.java

protected void Prepare() {
    mLocManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    mnCurrentExec = 0;//  w w w  . jav  a  2 s . com
    mmoFires = new HashMap<Long, FireItem>();

    mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    nUserCount = 0;
    nNasaCount = 0;
    nScanexCount = 0;
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
    stackBuilder.addParentStack(MainActivity.class);
    stackBuilder.addNextIntent(new Intent(this, MainActivity.class));
    //stackBuilder.addNextIntent(new Intent(this, ScanexNotificationsActivity.class));
    PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);

    mBuilder = new NotificationCompat.Builder(this).setSmallIcon(R.drawable.ic_fire_small)
            .setContentTitle(getString(R.string.stNewFireNotifications));
    mBuilder.setContentIntent(resultPendingIntent);

    Intent delIntent = new Intent(this, GetFiresService.class);
    delIntent.putExtra(COMMAND, SERVICE_NOTIFY_DISMISSED);
    PendingIntent deletePendingIntent = PendingIntent.getService(this, 0, delIntent,
            PendingIntent.FLAG_UPDATE_CURRENT);
    mBuilder.setDeleteIntent(deletePendingIntent);

    mInboxStyle = new NotificationCompat.InboxStyle();
    mInboxStyle.setBigContentTitle(getString(R.string.stNewFireNotificationDetailes));

    LoadScanexData();

    mSanextCookieTime = new Time();
    mSanextCookieTime.setToNow();
    msScanexLoginCookie = new String("not_set");

    mFillDataHandler = new Handler() {
        public void handleMessage(Message msg) {

            mnCurrentExec--;

            Bundle resultData = msg.getData();
            boolean bHaveErr = resultData.getBoolean(ERROR);
            if (bHaveErr) {
                SendError(resultData.getString(ERR_MSG));
            } else {
                int nType = resultData.getInt(SOURCE);
                String sData = resultData.getString(JSON);
                switch (nType) {
                case 3:
                    FillScanexData(nType, sData);
                    break;
                case 4:
                    msScanexLoginCookie = sData;
                    mSanextCookieTime.setToNow();
                    GetScanexData(false);
                    break;
                default:
                    FillData(nType, sData);
                    break;
                }
            }
            GetDataStoped();
        };
    };
}

From source file:com.yahala.ui.LoginActivitySmsView.java

@Override
public void setParams(Bundle params) {
    codeField.setText("");
    OSUtilities.setWaitingForSms(true);/*from   w  w w . ja v a 2s. c o m*/
    NotificationCenter.getInstance().addObserver(this, 998);
    currentParams = params;
    waitingForSms = true;
    String phone = params.getString("phone");
    requestPhone = params.getString("phoneFormated");
    phoneHash = params.getString("phoneHash");

    registered = params.getString("registered");
    FileLog.e("yahala",
            requestPhone + "  phoneHash:" + phoneHash + "registered" + params.getString("registered"));
    time = params.getInt("calltime");

    String number = PhoneFormat.getInstance().format(phone);
    confirmTextView.setText(Html.fromHtml(String.format(
            ApplicationLoader.applicationContext.getResources().getString(R.string.SentSmsCode) + " <b>%s</b>",
            number)));

    OSUtilities.showKeyboard(codeField);
    codeField.requestFocus();

    try {
        synchronized (timerSync) {
            if (timeTimer != null) {
                timeTimer.cancel();
                timeTimer = null;
            }
        }
    } catch (Exception e) {
        FileLog.e("yahala", e);
    }
    timeText.setText(String.format("%s 1:00",
            ApplicationLoader.applicationContext.getResources().getString(R.string.CallText)));
    lastCurrentTime = System.currentTimeMillis();
    timeTimer = new Timer();
    timeTimer.schedule(new TimerTask() {
        @Override
        public void run() {
            double currentTime = System.currentTimeMillis();
            double diff = currentTime - lastCurrentTime;
            time -= diff;
            lastCurrentTime = currentTime;
            Utilities.RunOnUIThread(new Runnable() {
                @Override
                public void run() {
                    if (time >= 1000) {
                        int minutes = time / 1000 / 60;
                        int seconds = time / 1000 - minutes * 60;
                        timeText.setText(String.format("%s %d:%02d", ApplicationLoader.applicationContext
                                .getResources().getString(R.string.CallText), minutes, seconds));
                    } else {
                        timeText.setText(ApplicationLoader.applicationContext.getResources()
                                .getString(R.string.Calling));
                        synchronized (timerSync) {
                            if (timeTimer != null) {
                                timeTimer.cancel();
                                timeTimer = null;
                            }
                        }
                        TLRPC.TL_auth_sendCall req = new TLRPC.TL_auth_sendCall();
                        req.phone_number = requestPhone;
                        req.phone_code_hash = phoneHash;
                    }
                }
            });
        }
    }, 0, 1000);
    sendSmsRequest();
}

From source file:com.gtdbrowser.data.service.GtdService.java

@Override
protected void onHandleIntent(final Intent intent) {
    final int workerType = intent.getIntExtra(INTENT_EXTRA_WORKER_TYPE, -1);
    String uri;//from  w w  w  .j  av a 2  s .  c  om
    Bundle resultBundle;

    try {
        switch (workerType) {
        case WORKER_TYPE_FILTERED_LIST:
            uri = intent.getStringExtra(INTENT_EXTRA_URI);
            resultBundle = FilteredListWorker.start(this, uri);
            sendSuccess(intent, resultBundle);
            break;
        case WORKER_TYPE_ATTACK_LIST:
            uri = intent.getStringExtra(INTENT_EXTRA_URI);
            resultBundle = AttackListWorker.start(this, uri);

            // Update the web service URI if there are more pages, otherwise
            // call it the end of pagination on this filter type.
            String ws_uri;
            if (resultBundle.getString("nextURI") != null)
                ws_uri = resultBundle.getString("nextURI");
            else
                ws_uri = END_PAGINATION;
            int total_count = resultBundle.getInt("total_count");

            SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
            SharedPreferences.Editor editor = settings.edit();
            editor.putString("attacks" + "_uri", ws_uri);
            editor.putInt("total_count", total_count);
            editor.commit();

            sendSuccess(intent, resultBundle);
            break;
        }
    } catch (final IllegalStateException e) {
        Log.e(LOG_TAG, "IllegalStateException", e);
        sendConnexionFailure(intent, null);
    } catch (final IOException e) {
        Log.e(LOG_TAG, "IOException", e);
        sendConnexionFailure(intent, null);
    } catch (final URISyntaxException e) {
        Log.e(LOG_TAG, "URISyntaxException", e);
        sendConnexionFailure(intent, null);
    } catch (final RestClientException e) {
        Log.e(LOG_TAG, "RestClientException", e);
        sendConnexionFailure(intent, null);
    } catch (final ParserConfigurationException e) {
        Log.e(LOG_TAG, "ParserConfigurationException", e);
        sendDataFailure(intent, null);
    } catch (final SAXException e) {
        Log.e(LOG_TAG, "SAXException", e);
        sendDataFailure(intent, null);
    } catch (final JSONException e) {
        Log.e(LOG_TAG, "JSONException", e);
        sendDataFailure(intent, null);
    }
    // This block (which should be the last one in your implementation)
    // will catch all the RuntimeException and send you back an error
    // that you can manage. If you remove this catch, the
    // RuntimeException will still crash the GtdService but you will not be
    // informed (as it is in 'background') so you should never remove this
    // catch
    catch (final RuntimeException e) {
        Log.e(LOG_TAG, "RuntimeException", e);
        sendDataFailure(intent, null);
    }
}

From source file:mp.paschalis.LoginFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    app = ((StartActivity) getSherlockActivity()).app;
    if (app.deviceType.equals(App.DeviceType.Regular))
        getSherlockActivity().getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    // If activity recreated (such as from screen rotate), restore
    // the previous Library selection set by onSaveInstanceState().
    // This is primarily necessary when in the two-pane layout.
    if (savedInstanceState != null) {
        mCurrentPosition = savedInstanceState.getInt(ARG_POSITION);
    }/*from   w  w  w . j  ava  2s  .co  m*/

    // In large and in regular layout, its the same Login layout
    return inflater.inflate(R.layout.login, container, false);

}

From source file:com.geekandroid.sdk.sample.JPushReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    Bundle bundle = intent.getExtras();
    Log.d(TAG, "[JPushReceiver] onReceive - " + intent.getAction() + ", extras: " + printBundle(bundle));

    if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction())) {
        String regId = bundle.getString(JPushInterface.EXTRA_REGISTRATION_ID);
        Log.d(TAG, "[JPushReceiver] Registration Id : " + regId);
        //send the Registration Id to your server...

    } else if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(intent.getAction())) {
        Log.d(TAG, "[JPushReceiver] ???: "
                + bundle.getString(JPushInterface.EXTRA_MESSAGE));
        processCustomMessage(context, bundle);

    } else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(intent.getAction())) {
        Log.d(TAG, "[JPushReceiver] ??");
        int notifactionId = bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID);
        Log.d(TAG, "[JPushReceiver] ??ID: " + notifactionId);

    } else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) {
        Log.d(TAG, "[JPushReceiver] ");
        JPushImpl.getInstance().clearAllNotifications();

        //Activity
        Intent i = new Intent(context, JPushOpenActivity.class);
        i.putExtras(bundle);//from w  w w  .ja va  2 s  .  c o  m
        //i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
        context.startActivity(i);

    } else if (JPushInterface.ACTION_RICHPUSH_CALLBACK.equals(intent.getAction())) {
        Log.d(TAG, "[JPushReceiver] RICH PUSH CALLBACK: "
                + bundle.getString(JPushInterface.EXTRA_EXTRA));
        //? JPushInterface.EXTRA_EXTRA ??Activity ..

    } else if (JPushInterface.ACTION_CONNECTION_CHANGE.equals(intent.getAction())) {
        boolean connected = intent.getBooleanExtra(JPushInterface.EXTRA_CONNECTION_CHANGE, false);
        Log.w(TAG, "[JPushReceiver]" + intent.getAction() + " connected state change to " + connected);
    } else {
        Log.d(TAG, "[JPushReceiver] Unhandled intent - " + intent.getAction());
    }
}

From source file:com.andersson.minesweeper.util.IabHelper.java

public String getPricesDev() throws RemoteException, JSONException {

    ArrayList<String> skuList = new ArrayList<String>();
    Collections.addAll(skuList, SkuDetails.SKU_LIST);

    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList("ITEM_ID_LIST", skuList);

    Bundle skuDetails = mService.getSkuDetails(3, mPackageName, "inapp", querySkus);

    int response = skuDetails.getInt("RESPONSE_CODE");
    if (response == 0) {
        ArrayList<String> responseList = skuDetails.getStringArrayList("DETAILS_LIST");

        for (String thisResponse : responseList) {
            JSONObject object = new JSONObject(thisResponse);
            String sku = object.getString("productId");
            String price = object.getString("price");
            logError(thisResponse);/*from   w ww. jav a 2 s . c om*/

        }
    }
    return "Not found";

}

From source file:edu.cnu.PowerTutor.ui.PowerViewer.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    prefs = PreferenceManager.getDefaultSharedPreferences(this);
    uid = getIntent().getIntExtra("uid", SystemInfo.AID_ALL);

    collecting = true;/*from w ww. j  a  va2 s .c  o m*/
    if (savedInstanceState != null) {
        collecting = savedInstanceState.getBoolean("collecting", true);
        componentNames = savedInstanceState.getStringArray("componentNames");
        noUidMask = savedInstanceState.getInt("noUidMask");
    }

    serviceIntent = new Intent(this, UMLoggerService.class);
    conn = new CounterServiceConnection();
}

From source file:androidx.media.MediaSession2StubImplBase.java

private ControllerInfo createControllerInfo(Bundle extras) {
    IMediaControllerCallback callback = IMediaControllerCallback.Stub
            .asInterface(extras.getBinder(ARGUMENT_ICONTROLLER_CALLBACK));
    String packageName = extras.getString(ARGUMENT_PACKAGE_NAME);
    int uid = extras.getInt(ARGUMENT_UID);
    int pid = extras.getInt(ARGUMENT_PID);
    // TODO: sanity check for packageName, uid, and pid.

    return new ControllerInfo(mContext, uid, pid, packageName, callback);
}