Example usage for android.os Message setData

List of usage examples for android.os Message setData

Introduction

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

Prototype

public void setData(Bundle data) 

Source Link

Document

Sets a Bundle of arbitrary data values.

Usage

From source file:my.home.lehome.service.SendMsgIntentService.java

private void saveAndNotify(Intent intent, String result) {
    Context context = getApplicationContext();
    int rep_code = -1;
    String desc;/*from w  ww .j a  v  a2  s .  co  m*/
    try {
        JSONObject jsonObject = new JSONObject(result);
        rep_code = jsonObject.getInt("code");
        desc = jsonObject.getString("desc");
    } catch (JSONException e) {
        e.printStackTrace();
        desc = context.getString(R.string.chat_error_json);
    }

    Messenger messenger;
    if (intent.hasExtra("messenger"))
        messenger = (Messenger) intent.getExtras().get("messenger");
    else
        messenger = null;

    Message repMsg = Message.obtain();
    repMsg.what = MSG_END_SENDING;

    ChatItem item = intent.getParcelableExtra("pass_item");
    ChatItem newItem = null;
    if (item != null) {
        if (rep_code == 200) {
            item.setState(Constants.CHATITEM_STATE_SUCCESS);
            DBStaticManager.updateChatItem(context, item);
        } else {
            if (rep_code == 415) {
                item.setState(Constants.CHATITEM_STATE_SUCCESS);
            } else {
                item.setState(Constants.CHATITEM_STATE_ERROR);
            }
            DBStaticManager.updateChatItem(context, item);

            newItem = new ChatItem();
            newItem.setContent(desc);
            newItem.setType(ChatItemConstants.TYPE_SERVER);
            newItem.setState(Constants.CHATITEM_STATE_ERROR); // always set true
            newItem.setDate(new Date());
            DBStaticManager.addChatItem(context, newItem);
        }
    } else {
        if (rep_code != 200) {
            Log.d(TAG, result);
            newItem = new ChatItem();
            newItem.setContent(getString(R.string.loc_send_error) + ":" + desc); // TODO - not only loc report
            newItem.setType(ChatItemConstants.TYPE_SERVER);
            newItem.setState(Constants.CHATITEM_STATE_SUCCESS); // always set true
            newItem.setDate(new Date());
            DBStaticManager.addChatItem(context, newItem);
        }
    }

    Log.d(TAG, "dequeue item: " + item);
    if (item == null)
        return;

    Bundle bundle = new Bundle();
    bundle.putParcelable("item", item);
    if (newItem != null)
        bundle.putParcelable("new_item", newItem);
    bundle.putInt("rep_code", rep_code);
    if (messenger != null) {
        repMsg.setData(bundle);
        try {
            messenger.send(repMsg);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    } else {
        Log.d(TAG, "messager is null, send broadcast instead:" + ACTION_SEND_MSG_END);
        Intent newIntent = new Intent(ACTION_SEND_MSG_END);
        newIntent.putExtras(bundle);
        sendBroadcast(newIntent);
    }
}

From source file:com.sharpcart.android.wizardpager.SharpCartLoginActivity.java

public void checkIfRegistered(final String email, final String password) {
    final Handler handler = new Handler() {
        @Override/*from w ww . j av a 2s. c o m*/
        public void handleMessage(final Message msg) {
            final Bundle bundle = msg.getData();
            isRegistered = bundle.getBoolean("isRegistered");

            //if the user is already registered, go back to first screen and let the user know
            if (isRegistered) {
                mPager.setCurrentItem(0);
                Toast.makeText(mContext, "You already have an account", Toast.LENGTH_SHORT).show();
            }
        }
    };

    final Runnable runnable = new Runnable() {
        @Override
        public void run() {
            final Message msg = handler.obtainMessage();
            boolean isRegistered = false;
            try {
                //before we perform a login we check that there is an Internet connection
                if (SharpCartUtilities.getInstance()
                        .hasActiveInternetConnection(SharpCartApplication.getAppContext())) {
                    final String response = LoginServiceImpl.sendCredentials(email, password);

                    if (response.equalsIgnoreCase(SharpCartConstants.SUCCESS)
                            || response.equalsIgnoreCase(SharpCartConstants.USER_EXISTS_IN_DB_CODE))
                        isRegistered = true;
                    else
                        isRegistered = false;
                }

            } catch (final SharpCartException e) {

            }

            final Bundle bundle = new Bundle();
            bundle.putBoolean("isRegistered", isRegistered);
            msg.setData(bundle);
            handler.sendMessage(msg);
        }
    };

    final Thread mythread = new Thread(runnable);
    mythread.start();

}

From source file:com.zld.ui.ZldNewActivity.java

@Override
public void onDataReceive(int handle, PlateResult plateResult, int uNumPlates, int eResultType, byte[] pImgFull,
        int nFullSize, byte[] pImgPlateClip, int nClipSize) {
    try {/*from  w  w w.j  a  v a 2 s  .c  om*/
        DeviceSet ds = this.getDeviceSetFromHandle(handle);

        if (ds == null) {
            Toast.makeText(ZldNewActivity.this, "?:", Toast.LENGTH_SHORT)
                    .show();
        }

        DeviceInfo di = ds.getDeviceInfo();

        String dateText = "";

        dateText += plateResult.struBDTime.bdt_year;
        dateText += "/";

        dateText += plateResult.struBDTime.bdt_mon;
        dateText += "/";

        dateText += plateResult.struBDTime.bdt_mday;
        dateText += " ";

        dateText += plateResult.struBDTime.bdt_hour;
        dateText += ":";

        dateText += plateResult.struBDTime.bdt_min;
        dateText += ":";

        dateText += plateResult.struBDTime.bdt_sec;

        String plateText = new String(plateResult.license, "GBK");

        if (!m_gb.getplateCallbackInfoTable().addCallbackInfo(di.DeviceName, plateText, dateText, pImgFull,
                pImgPlateClip)) {
            Toast.makeText(ZldNewActivity.this, "?", Toast.LENGTH_SHORT).show();
        }

        Log.i("visizion", "decodeByteArray begin");

        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inSampleSize = 4;//??? 
        options.inInputShareable = true;
        Bitmap bmp;
        try {

            bmp = BitmapFactory.decodeByteArray(pImgFull, 0, pImgFull.length, options);
            if (bmp != null) {
                Message msg = new Message();

                msg.what = PlateImage;

                msg.arg1 = ds.getDeviceInfo().id;
                msg.obj = bmp;
                Bundle data = new Bundle();
                data.putString("plate", plateText);
                msg.setData(data);

                handler.sendMessage(msg);
            }
        } catch (OutOfMemoryError e) {
            Log.e("Map", "Tile Loader (241) Out Of Memory Error " + e.getLocalizedMessage());
            System.gc();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            Log.i("visizion", "decodeByteArray end");
        }

    } catch (UnsupportedEncodingException e) {

        Toast.makeText(ZldNewActivity.this, "???", Toast.LENGTH_SHORT).show();
    }
}

From source file:com.smithdtyler.prettygoodmusicplayer.MusicPlaybackService.java

private void sendUpdateToClients() {
    List<Messenger> toRemove = new ArrayList<Messenger>();
    synchronized (mClients) {
        for (Messenger client : mClients) {
            Message msg = Message.obtain(null, MSG_SERVICE_STATUS);
            Bundle b = new Bundle();
            if (songFile != null) {
                b.putString(PRETTY_SONG_NAME, Utils.getPrettySongName(songFile));
                b.putString(PRETTY_ALBUM_NAME, songFile.getParentFile().getName());
                b.putString(PRETTY_ARTIST_NAME, songFile.getParentFile().getParentFile().getName());
            } else {
                // songFile can be null while we're shutting down.
                b.putString(PRETTY_SONG_NAME, " ");
                b.putString(PRETTY_ALBUM_NAME, " ");
                b.putString(PRETTY_ARTIST_NAME, " ");
            }//  ww w  . j av a  2 s. c  om

            b.putBoolean(IS_SHUFFLING, this._shuffle);

            if (mp.isPlaying()) {
                b.putInt(PLAYBACK_STATE, PlaybackState.PLAYING.ordinal());
            } else {
                b.putInt(PLAYBACK_STATE, PlaybackState.PAUSED.ordinal());
            }
            // We might not be able to send the position right away if mp is
            // still being created
            // so instead let's send the last position we knew about.
            if (mp.isPlaying()) {
                lastDuration = mp.getDuration();
                lastPosition = mp.getCurrentPosition();
            }
            b.putInt(TRACK_DURATION, lastDuration);
            b.putInt(TRACK_POSITION, lastPosition);
            msg.setData(b);
            try {
                client.send(msg);
            } catch (RemoteException e) {
                e.printStackTrace();
                toRemove.add(client);
            }
        }

        for (Messenger remove : toRemove) {
            mClients.remove(remove);
        }
    }
}

From source file:com.ichi2.anki.DeckPicker.java

/**
 * Perform the following tasks://from  w  w  w .ja v  a  2s .  com
 * Automatic backup
 * loadStudyOptionsFragment() if tablet
 * Automatic sync
 */
private void onFinishedStartup() {
    // create backup in background if needed
    BackupManager.performBackupInBackground(getCol().getPath());

    // Force a full sync if flag was set in upgrade path, asking the user to confirm if necessary
    if (mRecommendFullSync) {
        mRecommendFullSync = false;
        try {
            getCol().modSchema();
        } catch (ConfirmModSchemaException e) {
            // If libanki determines it's necessary to confirm the full sync then show a confirmation dialog
            // We have to show the dialog via the DialogHandler since this method is called via a Loader
            Resources res = getResources();
            Message handlerMessage = Message.obtain();
            handlerMessage.what = DialogHandler.MSG_SHOW_FORCE_FULL_SYNC_DIALOG;
            Bundle handlerMessageData = new Bundle();
            handlerMessageData.putString("message", res.getString(R.string.full_sync_confirmation_upgrade)
                    + "\n\n" + res.getString(R.string.full_sync_confirmation));
            handlerMessage.setData(handlerMessageData);
            getDialogHandler().sendMessage(handlerMessage);
        }
    }
    // Open StudyOptionsFragment if in fragmented mode
    if (mFragmented) {
        loadStudyOptionsFragment(false);
    }
    automaticSync();
}

From source file:net.networksaremadeofstring.rhybudd.ViewZenossEventsListFragment.java

public void DBGetThread() {
    //Log.e("DBGetThread", "Doing a DB lookup");

    if ((PreferenceManager.getDefaultSharedPreferences(getActivity()).getString("URL", "").equals("")
            || PreferenceManager.getDefaultSharedPreferences(getActivity()).getString("userName", "").equals("")
            || PreferenceManager.getDefaultSharedPreferences(getActivity()).getString("passWord", "")
                    .equals(""))) {
        //Log.e("DBGetThread", "Well we can't do this because we don't have any credentials ");
        return;/*www.ja  va 2 s .co  m*/
    }

    if (null != refreshStatus) {
        refreshStatus.setActionView(abprogress);
    } else {
        //Log.e("DBGetThread", "refreshStatus was null!");
    }

    listOfZenossEvents.clear();
    new Thread() {
        public void run() {
            Message msg = new Message();
            Bundle bndle = new Bundle();

            List<ZenossEvent> tempZenossEvents = null;

            try {
                RhybuddDataSource datasource = new RhybuddDataSource(getActivity());
                datasource.open();
                tempZenossEvents = datasource.GetRhybuddEvents();
                datasource.close();
            } catch (Exception e) {
                BugSenseHandler.sendExceptionMessage("ViewZenossEventsListFragment", "DBGetThread", e);
                e.printStackTrace();
                if (tempZenossEvents != null)
                    tempZenossEvents.clear();
            }

            if (tempZenossEvents != null && tempZenossEvents.size() > 0) {
                try {
                    listOfZenossEvents = tempZenossEvents;

                    eventsListHandler.sendEmptyMessage(EVENTSLISTHANDLER_SUCCESS);
                } catch (Exception e) {
                    BugSenseHandler.sendExceptionMessage("RhybuddHome", "DBGetThread", e);
                    bndle.putString("exception", e.getMessage());
                    msg.setData(bndle);
                    msg.what = EVENTSLISTHANDLER_ERROR;
                    eventsListHandler.sendMessage(msg);
                }
            } else {
                //Log.i("EventList","No DB data found, querying API directly");
                try {
                    eventsListHandler.sendEmptyMessage(EVENTSLISTHANDLER_DB_EMPTY);

                    if (tempZenossEvents != null)
                        tempZenossEvents.clear();

                    //Can we get away with just calling refresh now?

                    getActivity().runOnUiThread(new Runnable() {
                        public void run() {
                            //TODO This needs to be sent as a runnable or something
                            Refresh();
                        }
                    });

                } catch (Exception e) {
                    BugSenseHandler.sendExceptionMessage("RhybuddHome", "DBGetThread", e);
                    bndle.putString("exception", e.getMessage());
                    msg.setData(bndle);
                    msg.what = EVENTSLISTHANDLER_ERROR;
                    eventsListHandler.sendMessage(msg);
                }
            }
        }
    }.start();
}

From source file:com.yangtsaosoftware.pebblemessenger.services.PebbleCenter.java

@Override
public void onCreate() {
    super.onCreate();
    Handler pebbleCenterHandler = new PebbleCenterHandler();
    mPebbleCenterHandler = new Messenger(pebbleCenterHandler);
    Constants.log(TAG_NAME, "Create PebbleCenter Messenger.");
    loadPref();/*from ww  w .  j a v a 2  s. c o  m*/
    _contex = this;
    //   busyBegin=new Time();
    //        waitQueue=new ArrayDeque<PebbleMessage>();
    sendQueue = new ArrayDeque<PebbleDictionary>();
    bindService(new Intent(this, MessageProcessingService.class), connToMessageProcessing,
            Context.BIND_AUTO_CREATE);
    Thread prepareThread = new PrepareThread();
    prepareThread.start();
    Thread sendMsgThread = new SendMsgThread();
    sendMsgThread.start();
    isPebbleEnable = PebbleKit.isWatchConnected(_contex);
    PebbleKit.registerReceivedDataHandler(_contex, new PebbleKit.PebbleDataReceiver(Constants.PEBBLE_UUID) {
        @Override
        public void receiveData(Context context, int transactionId, PebbleDictionary data) {
            PebbleKit.sendAckToPebble(_contex, transactionId);
            //          appStatue++;
            Constants.log(TAG_NAME, "Received data form pebble");
            switch (data.getUnsignedIntegerAsLong(ID_COMMAND).intValue()) {
            case REQUEST_TRANSID_CALL_TABLE: {
                Constants.log(TAG_NAME, "Request call table.");
                clean_SendQue();
                Message msg = Message.obtain();
                msg.what = MessageProcessingService.MSG_GET_CALL_TABLE;
                try {
                    rMessageProcessingHandler.send(msg);
                } catch (RemoteException e) {
                    e.printStackTrace();
                }
            }
                break;
            case REQUEST_TRANSID_MESSAGE_TABLE: {
                Constants.log(TAG_NAME, "Request message table.");
                clean_SendQue();
                Message msg = Message.obtain();
                msg.what = MessageProcessingService.MSG_GET_MESSAGE_TABLE;
                try {
                    rMessageProcessingHandler.send(msg);
                } catch (RemoteException e) {
                    e.printStackTrace();
                }
            }
                break;
            case REQUEST_TRANSID_CALL: {
                clean_SendQue();
                Message msg = Message.obtain();
                msg.what = MessageProcessingService.MSG_GET_CALL;
                Bundle b = new Bundle();
                b.putString(MessageDbHandler.COL_CALL_ID, data.getString(ID_EXTRA_DATA));
                Constants.log(TAG_NAME, "Request call id:" + data.getString(ID_EXTRA_DATA));

                msg.setData(b);
                try {
                    rMessageProcessingHandler.send(msg);
                } catch (RemoteException e) {
                    e.printStackTrace();
                }

            }
                break;
            case REQUEST_TRANSID_MESSAGE:
                clean_SendQue();
                Message msg = Message.obtain();
                msg.what = MessageProcessingService.MSG_GET_MESSAGE;
                Bundle b = new Bundle();
                b.putString(MessageDbHandler.COL_MESSAGE_ID, data.getString(ID_EXTRA_DATA));
                Constants.log(TAG_NAME, "Request message id:" + data.getString(ID_EXTRA_DATA));

                msg.setData(b);
                try {
                    rMessageProcessingHandler.send(msg);
                } catch (RemoteException e) {
                    e.printStackTrace();
                }
                break;
            case REQUEST_TRANSID_PICKUP_PHONE:
                TelephonyManager telMag = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
                Constants.log("Receivephone", "Receive phone:" + data.getString(ID_EXTRA_DATA2));
                if (telMag.getCallState() == TelephonyManager.CALL_STATE_RINGING) {
                    switch (data.getUnsignedIntegerAsLong(ID_EXTRA_DATA).intValue()) {
                    case REQUEST_EXTRA_SPEAKER_ON:
                        answerCall(true);
                        break;
                    case REQUEST_EXTRA_SPEAKER_OFF:
                        answerCall(false);
                        break;
                    }
                } else {
                    switch (data.getUnsignedIntegerAsLong(ID_EXTRA_DATA).intValue()) {
                    case REQUEST_EXTRA_SPEAKER_ON:
                        dialNumber(data.getString(ID_EXTRA_DATA2), true);
                        break;
                    case REQUEST_EXTRA_SPEAKER_OFF:
                        dialNumber(data.getString(ID_EXTRA_DATA2), false);
                        break;
                    }

                }
                //                pebbleBusy = false;
                break;
            case REQUEST_TRANSID_HANGOFF_PHONE:
                endCall();
                //                pebbleBusy=false;

                break;
            case REQUEST_TRANSID_HANGOFF_SMS1:
                Constants.log(TAG_NAME, "Request hangoff and send sms1");

                endCall();
                doSendSMSTo(data.getString(ID_EXTRA_DATA), sms1);
                //               pebbleBusy=false;

                break;
            case REQUEST_TRANSID_HANGOFF_SMS2:
                Constants.log(TAG_NAME, "Request hangoff and send sms2");

                endCall();
                doSendSMSTo(data.getString(ID_EXTRA_DATA), sms2);
                //              pebbleBusy=false;

                break;
            case REQUEST_TRANSID_CLOSE_APP:
                Constants.log(TAG_NAME, "Request close app command.");
                sendMsgThreadHandler.sendEmptyMessage(SEND_CLOSE_APP);
                //               need_delay=true;

                break;
            case REQUEST_TRANSID_NEXTPAGE:
                Constants.log(TAG_NAME, "Request send next page.");

                sendMsgThreadHandler.sendEmptyMessage(SEND_NEXT_PAGE);
                break;
            case REQUEST_TRANSID_READ_NOTIFY: {
                Constants.log(TAG_NAME, "Request  read msg");
                Message read_msg = Message.obtain();
                read_msg.what = MessageProcessingService.MSG_READ;
                Bundle bd = new Bundle();
                bd.putString(MessageDbHandler.COL_MESSAGE_ID,
                        data.getUnsignedIntegerAsLong(ID_EXTRA_DATA).toString());
                read_msg.setData(bd);
                try {
                    rMessageProcessingHandler.send(read_msg);
                } catch (RemoteException e) {
                    e.printStackTrace();
                }
            }
                break;
            case REQUEST_TRANSID_IM_FREE:
                Constants.log(TAG_NAME, "Request pebble app is free to receive data.");

                //               need_delay = data.getUnsignedInteger(ID_EXTRA_DATA).intValue() == REQUEST_EXTRA_DELAY_ON ;
                //               clean_SendQue();
                break;
            case REQUEST_TRANSID_VERSION: {
                send_test_get_return = true;
                String result = data.getString(ID_EXTRA_DATA);
                Constants.log("PmpVersion", result);
                StringTokenizer tokens = new StringTokenizer(result, ".");

                Intent inner_intent = new Intent(SetupFragment.class.getName());
                inner_intent.putExtra(Constants.BROADCAST_VERSION,
                        new byte[] { Byte.parseByte(tokens.nextToken()), Byte.parseByte(tokens.nextToken()),
                                Byte.parseByte(tokens.nextToken()) });
                LocalBroadcastManager.getInstance(context).sendBroadcast(inner_intent);
                sendMsgThreadHandler.sendEmptyMessage(SEND_CLOSE_APP);
                break;
            }
            }
        }
    });

    PebbleKit.registerReceivedAckHandler(_contex, new PebbleKit.PebbleAckReceiver(Constants.PEBBLE_UUID) {
        @Override
        public void receiveAck(Context context, int transactionId) {
            Constants.log(TAG_NAME, "Get a receiveAck:" + String.valueOf(transactionId));
            switch (transactionId) {
            case TRANS_ID_COMMON:
                Constants.log(TAG_NAME, "Send continue...");
                //                  pebbleBusy=true;
                sendMsgThreadHandler.sendEmptyMessage(SEND_CONTINUE);
                break;
            case TRANS_ID_END:
                send_full_page = true;
                break;
            case TRANS_ID_EMPTY:
                //                 pebbleBusy=true;
                sendMsgThreadHandler.sendEmptyMessage(SEND_CONTINUE);
                break;
            case TRANS_ID_TEST: {
                break;
            }
            }
        }
    });

    PebbleKit.registerReceivedNackHandler(_contex, new PebbleKit.PebbleNackReceiver(Constants.PEBBLE_UUID) {
        @Override
        public void receiveNack(Context context, int transactionId) {
            Constants.log(TAG_NAME, "Get a receivedNack:" + String.valueOf(transactionId));
            if (PebbleKit.isWatchConnected(_contex)) {
                switch (transactionId) {
                case TRANS_ID_COMMON:
                    sendMsgThreadHandler.sendEmptyMessage(SEND_CONTINUE);
                    break;
                case TRANS_ID_END:
                    send_full_page = true;
                    break;
                case TRANS_ID_EMPTY:
                    //                   appStatue=0;
                    sendMsgThreadHandler.sendEmptyMessage(SEND_OPEN_APP);
                    break;
                case TRANS_ID_TEST: {
                    Intent inner_intent = new Intent(SetupFragment.class.getName());
                    inner_intent.putExtra(Constants.BROADCAST_VERSION, new byte[] { 0, 0, 0 });
                    LocalBroadcastManager.getInstance(context).sendBroadcast(inner_intent);
                }
                }
            } else {
                sendMsgThreadHandler.sendEmptyMessage(SEND_CLOSE_APP);
            }

        }
    });

    PebbleKit.registerPebbleConnectedReceiver(_contex, new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            isPebbleEnable = true;
        }
    });

    PebbleKit.registerPebbleDisconnectedReceiver(_contex, new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            isPebbleEnable = false;
            sendMsgThreadHandler.sendEmptyMessage(SEND_CLOSE_APP);
        }
    });

    BroadcastReceiver br = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            int command = intent.getIntExtra(Constants.BROADCAST_COMMAND, Constants.BROADCAST_PREFER_CHANGED);

            switch (command) {
            case Constants.BROADCAST_PREFER_CHANGED:
                loadPref();
                break;
            case Constants.BROADCAST_CALL_IDLE:
                if (callEnable) {
                    sendMsgThreadHandler.sendEmptyMessage(SEND_CALL_END);
                }
                break;
            case Constants.BROADCAST_CALL_HOOK:
                if (callEnable) {
                    sendMsgThreadHandler.sendEmptyMessage(SEND_CALL_HOOK);
                }
                break;
            case Constants.BROADCAST_PEBBLE_TEST:
                if (isPebbleEnable) {
                    prepareThreadHandler.sendEmptyMessage(PREPARE_TEST);
                }
                break;
            }
        }
    };
    IntentFilter intentFilter = new IntentFilter(PebbleCenter.class.getName());
    LocalBroadcastManager.getInstance(getApplicationContext()).registerReceiver(br, intentFilter);
}

From source file:org.mozilla.gecko.GeckoApp.java

@Override
public void onResume() {
    Log.i(LOGTAG, "resume");
    if (checkLaunchState(LaunchState.GeckoRunning))
        GeckoAppShell.sendEventToGecko(GeckoEvent.createResumeEvent(mOwnActivityDepth));

    // After an onPause, the activity is back in the foreground.
    // Undo whatever we did in onPause.
    super.onResume();

    /* We load the initial UI and wait until it is shown to the user
       to continue other initializations and loading about:home (if needed) */
    if (!mInitialized) {
        Bundle bundle = new Bundle();
        bundle.putInt(HANDLER_MSG_TYPE, HANDLER_MSG_TYPE_INITIALIZE);

        Message message = mMainHandler.obtainMessage();
        message.setData(bundle);
        mMainHandler.sendMessage(message);
    }//from  ww w. j a v  a2 s  .  com

    int newOrientation = getResources().getConfiguration().orientation;

    if (mOrientation != newOrientation) {
        mOrientation = newOrientation;
        refreshActionBar();
    }

    registerReceiver(mConnectivityReceiver, mConnectivityFilter);
    GeckoNetworkManager.getInstance().start();

    if (mOwnActivityDepth > 0)
        mOwnActivityDepth--;
}

From source file:com.max2idea.android.limbo.main.LimboActivity.java

public static void showAlertHtml(String title, String message, Handler handler) {
    Message msg1 = handler.obtainMessage();
    Bundle b = new Bundle();
    b.putInt("message_type", Const.UIUTILS_SHOWALERT_HTML);
    b.putString("title", title);
    b.putString("body", message);
    msg1.setData(b);
    handler.sendMessage(msg1);//from  w w w.  j  a v a  2  s .c om
}

From source file:com.max2idea.android.limbo.main.LimboActivity.java

public static void showAlertLicense(String title, String message, Handler handler) {
    Message msg1 = handler.obtainMessage();
    Bundle b = new Bundle();
    b.putInt("message_type", Const.UIUTILS_SHOWALERT_LICENSE);
    b.putString("title", title);
    b.putString("body", message);
    msg1.setData(b);
    handler.sendMessage(msg1);// w  w w .  j  a v  a  2  s .  c  o  m
}