Example usage for android.content Intent getAction

List of usage examples for android.content Intent getAction

Introduction

In this page you can find the example usage for android.content Intent getAction.

Prototype

public @Nullable String getAction() 

Source Link

Document

Retrieve the general action to be performed, such as #ACTION_VIEW .

Usage

From source file:com.cleverzone.zhizhi.capture.CaptureActivity.java

@Override
protected void onResume() {
    super.onResume();

    // historyManager must be initialized here to update the history preference
    //        historyManager = new HistoryManager(this);
    //        historyManager.trimHistory();

    // CameraManager must be initialized here, not in onCreate(). This is necessary because we don't
    // want to open the camera driver and measure the screen size if we're going to show the help on
    // first launch. That led to bugs where the scanning rectangle was the wrong size and partially
    // off screen.
    cameraManager = new CameraManager(getApplication());

    viewfinderView = (ViewfinderView) findViewById(R.id.viewfinder_view);
    viewfinderView.setCameraManager(cameraManager);

    resultView = findViewById(R.id.result_view);
    statusView = (TextView) findViewById(R.id.status_view);

    handler = null;//  w  ww . j a va  2 s.  com
    lastResult = null;

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);

    //        if (prefs.getBoolean(PreferencesActivity.KEY_DISABLE_AUTO_ORIENTATION, true)) {
    //            setRequestedOrientation(getCurrentOrientation());
    //        } else {
    //            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
    //        }
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);

    resetStatusView();

    beepManager.updatePrefs();
    //        ambientLightManager.start(cameraManager);

    inactivityTimer.onResume();

    Intent intent = getIntent();

    //        copyToClipboard = prefs.getBoolean(PreferencesActivity.KEY_COPY_TO_CLIPBOARD, true)
    //                && (intent == null || intent.getBooleanExtra(Intents.Scan.SAVE_HISTORY, true));

    source = IntentSource.NONE;
    sourceUrl = null;
    //        scanFromWebPageManager = null;
    decodeFormats = null;
    characterSet = null;

    if (intent != null) {

        String action = intent.getAction();
        String dataString = intent.getDataString();

        if (Intents.Scan.ACTION.equals(action)) {

            // Scan the formats the intent requested, and return the result to the calling activity.
            source = IntentSource.NATIVE_APP_INTENT;
            decodeFormats = DecodeFormatManager.parseDecodeFormats(intent);
            decodeHints = DecodeHintManager.parseDecodeHints(intent);

            if (intent.hasExtra(Intents.Scan.WIDTH) && intent.hasExtra(Intents.Scan.HEIGHT)) {
                int width = intent.getIntExtra(Intents.Scan.WIDTH, 0);
                int height = intent.getIntExtra(Intents.Scan.HEIGHT, 0);
                if (width > 0 && height > 0) {
                    cameraManager.setManualFramingRect(width, height);
                }
            }

            if (intent.hasExtra(Intents.Scan.CAMERA_ID)) {
                int cameraId = intent.getIntExtra(Intents.Scan.CAMERA_ID, -1);
                if (cameraId >= 0) {
                    cameraManager.setManualCameraId(cameraId);
                }
            }

            String customPromptMessage = intent.getStringExtra(Intents.Scan.PROMPT_MESSAGE);
            if (customPromptMessage != null) {
                statusView.setText(customPromptMessage);
            }

        } else if (dataString != null && dataString.contains("http://www.google")
                && dataString.contains("/m/products/scan")) {

            // Scan only products and send the result to mobile Product Search.
            source = IntentSource.PRODUCT_SEARCH_LINK;
            sourceUrl = dataString;
            decodeFormats = DecodeFormatManager.PRODUCT_FORMATS;

        } else if (isZXingURL(dataString)) {

            // Scan formats requested in query string (all formats if none specified).
            // If a return URL is specified, send the results there. Otherwise, handle it ourselves.
            source = IntentSource.ZXING_LINK;
            sourceUrl = dataString;
            Uri inputUri = Uri.parse(dataString);
            //                scanFromWebPageManager = new ScanFromWebPageManager(inputUri);
            decodeFormats = DecodeFormatManager.parseDecodeFormats(inputUri);
            // Allow a sub-set of the hints to be specified by the caller.
            decodeHints = DecodeHintManager.parseDecodeHints(inputUri);

        }

        characterSet = intent.getStringExtra(Intents.Scan.CHARACTER_SET);

    }

    SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
    SurfaceHolder surfaceHolder = surfaceView.getHolder();
    if (hasSurface) {
        // The activity was paused but not stopped, so the surface still exists. Therefore
        // surfaceCreated() won't be called, so init the camera here.
        initCamera(surfaceHolder);
    } else {
        // Install the callback and wait for surfaceCreated() to init the camera.
        surfaceHolder.addCallback(this);
    }
}

From source file:org.openhab.habdroid.ui.OpenHABMainActivity.java

/**
 * This method is called when activity receives a new intent while running
 *///from  w  w w  .  j  av  a 2 s.c o m
@Override
public void onNewIntent(Intent newIntent) {
    if (newIntent.getAction() != null) {
        Log.d(TAG, "New intent received = " + newIntent.getAction());
        if (newIntent.getAction().equals("android.nfc.action.NDEF_DISCOVERED")) {
            Log.d(TAG, "This is NFC action");
            if (newIntent.getDataString() != null) {
                Log.d(TAG, "Action data = " + newIntent.getDataString());
                onNfcTag(newIntent.getDataString());
            }
        } else if (newIntent.getAction().equals("org.openhab.notification.selected")) {
            onNotificationSelected(newIntent);
        } else if (newIntent.getAction().equals("android.intent.action.VIEW")) {
            Log.d(TAG, "This is URL Action");
            onNfcTag(newIntent.getDataString());
        }
    }
}

From source file:com.kncwallet.wallet.ui.WalletActivity.java

private void handleIntent(@Nonnull final Intent intent) {
    final String action = intent.getAction();

    if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) {
        final String inputType = intent.getType();
        final NdefMessage ndefMessage = (NdefMessage) intent
                .getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES)[0];
        final byte[] input = Nfc.extractMimePayload(Constants.MIMETYPE_TRANSACTION, ndefMessage);

        new BinaryInputParser(inputType, input) {
            @Override//from  w  ww . j  a va2 s  .com
            protected void bitcoinRequest(final Address address, final String addressLabel,
                    final BigInteger amount, final String bluetoothMac) {
                cannotClassify(inputType);
            }

            @Override
            protected void directTransaction(final Transaction transaction) {
                processDirectTransaction(transaction);
            }

            @Override
            protected void error(final int messageResId, final Object... messageArgs) {
                dialog(WalletActivity.this, null, 0, messageResId, messageArgs);
            }
        }.parse();

    } else if (Constants.WIDGET_START_SEND_QR.equals(action)) { //started by widget

        ActionBar actionBar = getSupportActionBar();
        actionBar.setSelectedNavigationItem(0);
        handleScan();

    } else if (Constants.WIDGET_START_RECEIVE.equals(action)) {

        ActionBar actionBar = getSupportActionBar();
        actionBar.setSelectedNavigationItem(2);

    } else if (Constants.WIDGET_START_SEND.equals(action)) {
        ActionBar actionBar = getSupportActionBar();
        actionBar.setSelectedNavigationItem(0);
    }
}

From source file:android.support.v7.media.RemotePlaybackClient.java

void handleError(Intent intent, ActionCallback callback, String error, Bundle data) {
    final int code;
    if (data != null) {
        code = data.getInt(MediaControlIntent.EXTRA_ERROR_CODE, MediaControlIntent.ERROR_UNKNOWN);
    } else {//from ww  w  .  j  a  va  2s  . com
        code = MediaControlIntent.ERROR_UNKNOWN;
    }
    if (DEBUG) {
        Log.w(TAG, "Received error from " + intent.getAction() + ": error=" + error + ", code=" + code
                + ", data=" + bundleToString(data));
    }
    callback.onError(error, code, data);
}

From source file:edu.mit.media.funf.probe.Probe.java

/**
 * Send some values to each requesting pending intent
 * @param valuesIntent//w ww  .ja v a  2  s . c  o  m
 */
protected void callback(long epochTimestamp, Intent valuesIntent, PendingIntent callback) {
    assert requestsIntent != null;
    valuesIntent.putExtra(PROBE, getClass().getName());
    valuesIntent.putExtra(TIMESTAMP, epochTimestamp);
    Log.d(TAG, "Queing probe " + valuesIntent.getAction() + " callback at " + epochTimestamp);
    if (isIntentHandlerThread()) {
        _callback_registered(valuesIntent, callback);
    } else {
        // Run on message queue to avoid concurrent modification of requests
        Intent callbackRegisteredIntent = new Intent(ACTION_INTERNAL_CALLBACK_REGISTERED, null, this,
                Probe.class);
        callbackRegisteredIntent.putExtra(INTERNAL_CALLBACK_INTENT, valuesIntent);
        callbackRegisteredIntent.putExtra(CALLBACK_KEY, callback);
        queueIntent(callbackRegisteredIntent);
    }
}

From source file:ca.rmen.android.poetassistant.main.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    if (BuildConfig.DEBUG && ActivityManager.isUserAMonkey()) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }//from   w w  w .  j a  v  a  2 s  .c o  m
    super.onCreate(savedInstanceState);
    Log.d(TAG, "onCreate() called with: " + "savedInstanceState = [" + savedInstanceState + "]");
    mBinding = DataBindingUtil.setContentView(this, R.layout.activity_main);
    setSupportActionBar(mBinding.toolbar);
    Intent intent = getIntent();
    Uri data = intent.getData();
    mPagerAdapter = new PagerAdapter(this, getSupportFragmentManager(), intent);
    mPagerAdapter.registerDataSetObserver(mAdapterChangeListener);

    // Set up the ViewPager with the sections adapter.
    mBinding.viewPager.setAdapter(mPagerAdapter);
    mBinding.viewPager.setOffscreenPageLimit(5);
    mBinding.viewPager.addOnPageChangeListener(mOnPageChangeListener);

    mBinding.tabs.setupWithViewPager(mBinding.viewPager);
    AppBarLayoutHelper.enableAutoHide(mBinding);
    mAdapterChangeListener.onChanged();

    // If the app was launched with a query for the a particular tab, focus on that tab.
    if (data != null && data.getHost() != null) {
        Tab tab = Tab.parse(data.getHost());
        if (tab == null)
            tab = Tab.DICTIONARY;
        mBinding.viewPager.setCurrentItem(mPagerAdapter.getPositionForTab(tab));
    } else if (Intent.ACTION_SEND.equals(intent.getAction())) {
        mBinding.viewPager.setCurrentItem(mPagerAdapter.getPositionForTab(Tab.READER));
    }

    mSearch = new Search(this, mBinding.viewPager);
    loadDictionaries();
    setVolumeControlStream(AudioManager.STREAM_MUSIC);
}

From source file:cc.mintcoin.wallet.ui.SendCoinsFragment.java

@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.send_coins_fragment, container);

    payeeNameView = (TextView) view.findViewById(R.id.send_coins_payee_name);
    payeeOrganizationView = (TextView) view.findViewById(R.id.send_coins_payee_organization);
    payeeVerifiedByView = (TextView) view.findViewById(R.id.send_coins_payee_verified_by);

    receivingAddressView = (AutoCompleteTextView) view.findViewById(R.id.send_coins_receiving_address);
    receivingAddressView.setAdapter(new AutoCompleteAddressAdapter(activity, null));
    receivingAddressView.setOnFocusChangeListener(receivingAddressListener);
    receivingAddressView.addTextChangedListener(receivingAddressListener);

    receivingStaticView = view.findViewById(R.id.send_coins_receiving_static);
    receivingStaticAddressView = (TextView) view.findViewById(R.id.send_coins_receiving_static_address);
    receivingStaticLabelView = (TextView) view.findViewById(R.id.send_coins_receiving_static_label);

    receivingStaticView.setOnFocusChangeListener(new OnFocusChangeListener() {
        private ActionMode actionMode;

        @Override/* w w  w .  j  a  v  a 2 s.co  m*/
        public void onFocusChange(final View v, final boolean hasFocus) {
            if (hasFocus) {
                final Address address = paymentIntent.hasAddress() ? paymentIntent.getAddress()
                        : (validatedAddress != null ? validatedAddress.address : null);
                if (address != null)
                    actionMode = activity.startActionMode(new ReceivingAddressActionMode(address));
            } else {
                actionMode.finish();
            }
        }
    });

    final CurrencyAmountView btcAmountView = (CurrencyAmountView) view.findViewById(R.id.send_coins_amount_btc);
    btcAmountView.setCurrencySymbol(config.getBtcPrefix());
    btcAmountView.setInputPrecision(config.getBtcMaxPrecision());
    btcAmountView.setHintPrecision(config.getBtcPrecision());
    btcAmountView.setShift(config.getBtcShift());

    final CurrencyAmountView localAmountView = (CurrencyAmountView) view
            .findViewById(R.id.send_coins_amount_local);
    localAmountView.setInputPrecision(Constants.LOCAL_PRECISION);
    localAmountView.setHintPrecision(Constants.LOCAL_PRECISION);
    amountCalculatorLink = new CurrencyCalculatorLink(btcAmountView, localAmountView);
    amountCalculatorLink.setExchangeDirection(config.getLastExchangeDirection());

    directPaymentEnableView = (CheckBox) view.findViewById(R.id.send_coins_direct_payment_enable);
    directPaymentEnableView.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) {
            if (paymentIntent.isBluetoothPaymentUrl() && isChecked && !bluetoothAdapter.isEnabled()) {
                // ask for permission to enable bluetooth
                startActivityForResult(new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE),
                        REQUEST_CODE_ENABLE_BLUETOOTH);
            }
        }
    });

    directPaymentMessageView = (TextView) view.findViewById(R.id.send_coins_direct_payment_message);

    sentTransactionView = (ListView) view.findViewById(R.id.send_coins_sent_transaction);
    sentTransactionListAdapter = new TransactionsListAdapter(activity, wallet, application.maxConnectedPeers(),
            false);
    sentTransactionView.setAdapter(sentTransactionListAdapter);

    viewGo = (Button) view.findViewById(R.id.send_coins_go);
    viewGo.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(final View v) {
            validateReceivingAddress(true);
            isAmountValid();

            if (everythingValid())
                handleGo();
            else
                requestFocusFirst();
        }
    });

    amountCalculatorLink.setNextFocusId(viewGo.getId());

    viewCancel = (Button) view.findViewById(R.id.send_coins_cancel);
    viewCancel.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(final View v) {
            if (state == State.INPUT)
                activity.setResult(Activity.RESULT_CANCELED);

            activity.finish();
        }
    });

    popupMessageView = (TextView) inflater.inflate(R.layout.send_coins_popup_message, container);

    if (savedInstanceState != null) {
        restoreInstanceState(savedInstanceState);
    } else {
        final Intent intent = activity.getIntent();
        final String action = intent.getAction();
        final Uri intentUri = intent.getData();
        final String scheme = intentUri != null ? intentUri.getScheme() : null;
        final String mimeType = intent.getType();

        if ((Intent.ACTION_VIEW.equals(action) || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action))
                && intentUri != null && "mintcoin".equals(scheme)) {
            initStateFromBitcoinUri(intentUri);
        } else if ((NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action))
                && Constants.MIMETYPE_PAYMENTREQUEST.equals(mimeType)) {
            final NdefMessage ndefMessage = (NdefMessage) intent
                    .getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES)[0];
            final byte[] ndefMessagePayload = Nfc.extractMimePayload(Constants.MIMETYPE_PAYMENTREQUEST,
                    ndefMessage);
            initStateFromPaymentRequest(mimeType, ndefMessagePayload);
        } else if ((Intent.ACTION_VIEW.equals(action)) && Constants.MIMETYPE_PAYMENTREQUEST.equals(mimeType)) {
            final byte[] paymentRequest = BitcoinIntegration.paymentRequestFromIntent(intent);

            if (intentUri != null)
                initStateFromIntentUri(mimeType, intentUri);
            else if (paymentRequest != null)
                initStateFromPaymentRequest(mimeType, paymentRequest);
            else
                throw new IllegalArgumentException();
        } else if (intent.hasExtra(SendCoinsActivity.INTENT_EXTRA_PAYMENT_INTENT)) {
            initStateFromIntentExtras(intent.getExtras());
        } else {
            updateStateFrom(PaymentIntent.blank());
        }
    }

    return view;
}

From source file:it.evilsocket.dsploit.core.UpdateService.java

/**
 * connect to the notification manager and create a notification builder.
 * it also setup the cancellation Intent for get notified when our notification got cancelled.
 *//* ww w.j  a v a  2  s  .  c  o m*/
private void setupNotification() {
    // get notification manager
    mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    // get notification builder
    mBuilder = new NotificationCompat.Builder(this);
    // create a broadcast receiver to get actions
    // performed on the notification by the user
    mReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            if (action == null)
                return;
            // user cancelled our notification
            if (action.equals(NOTIFICATION_CANCELLED)) {
                mRunning = false;
                stopSelf();
            }
        }
    };
    // register our receiver
    registerReceiver(mReceiver, new IntentFilter(NOTIFICATION_CANCELLED));
    // set common notification actions
    mBuilder.setDeleteIntent(
            PendingIntent.getBroadcast(this, CANCEL_CODE, new Intent(NOTIFICATION_CANCELLED), 0));
    mBuilder.setContentIntent(PendingIntent.getActivity(this, 0, new Intent(), 0));
}

From source file:com.hybris.mobile.app.commerce.fragment.ProductDetailFragmentBase.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_product_detail, container, false);

    // Initialize View by linking and giving instance to xml element in the
    // layout/* ww w  .j  a v  a  2s .com*/
    mCloseProductDetailButton = (ImageButton) view.findViewById(R.id.product_detail_exit);
    mProductDetaiNameText = (TextView) view.findViewById(R.id.product_detail_name);
    mOrderFormButton = (ImageButton) view.findViewById(R.id.product_detail_order_form);
    mViewPager = (ViewPager) view.findViewById(R.id.product_detail_view_pager);
    mImageAdapter = new ImagePagerAdapter(new ArrayList<Image>());
    mLayoutIndicator = (LinearLayout) view.findViewById(R.id.product_detail_view_pager_indicator_bar);
    mProductPrice = (TextView) view.findViewById(R.id.product_detail_volume_price);
    mVolumePricingExpandableButton = (Button) view.findViewById(R.id.product_detail_volume_pricing_button);
    mVolumePricingExpandableLayout = (TableLayout) view
            .findViewById(R.id.product_detail_volume_pricing_table_layout);
    mProductDetailDescriptionLayout = (LinearLayout) view.findViewById(R.id.product_detail_description_layout);
    mProductShortDescription = (TextView) view.findViewById(R.id.product_detail_short_description);
    mStocklevelText = (TextView) view.findViewById(R.id.product_detail_stocklevel_text);
    mTotalPriceText = (TextView) view.findViewById(R.id.product_detail_total_price_text);
    mQuantityEditText = (EditText) view.findViewById(R.id.product_detail_quantity_editText);
    mAddToCartButton = (LinearLayout) view.findViewById(R.id.product_detail_add_to_cart_layout_button);
    mProductDetailAddToCartText = (TextView) view.findViewById(R.id.product_detail_add_to_cart_text);
    mProductDetailExpandableButton = (Button) view.findViewById(R.id.product_detail_expandable_button);
    mProductDetailExpandableText = (TextView) view.findViewById(R.id.product_detail_expandable_text);
    mDeliveryExpandableButton = (Button) view.findViewById(R.id.product_detail_delivery_expandable_button);
    mDeliveryExpandableText = (TextView) view.findViewById(R.id.product_detail_delivery_expandable_text);
    mProductDetailVariantSpinner1 = (Spinner) view.findViewById(R.id.product_detail_variant_spinner_1);
    mProductDetailVariantSpinner2 = (Spinner) view.findViewById(R.id.product_detail_variant_spinner_2);
    mProductDetailVariantSpinner3 = (Spinner) view.findViewById(R.id.product_detail_variant_spinner_3);
    mStocklevelTextLoading = (ProgressBar) view.findViewById(R.id.product_detail_stocklevel_text_loading);
    mNoImage = view.findViewById(R.id.product_item_no_image);
    mRatingBar = (RatingBar) view.findViewById(R.id.product_detail_rating);
    mReviews = (TextView) view.findViewById(R.id.product_detail_reviews);

    mReviews.setOnClickListener(mReviewOnClickListener);

    // Zoom UI
    mProductDetailScrollView = (ScrollView) view.findViewById(R.id.product_detail_scrollView);
    mScrollViewLayout = (LinearLayout) view.findViewById(R.id.product_detail_scrollView_layout);
    mImageLayout = (LinearLayout) view.findViewById(R.id.product_detail_image_layout);
    mMiddleSection = (LinearLayout) view.findViewById(R.id.product_detail_middle_section);
    mBottomSection = (LinearLayout) view.findViewById(R.id.product_detail_bottom_section);
    mViewDivider = view.findViewById(R.id.product_detail_middle_divider);

    // Only show description when not blank
    mProductDetailDescriptionLayout.setVisibility(View.GONE);

    // Listener
    mCloseProductDetailButton.setOnClickListener(exitProductDetailButtonListener);
    mOrderFormButton.setOnClickListener(orderFormButtonListener);
    mViewPager.setOnTouchListener(imageViewPagerOnTouchListener);
    mViewPager.addOnPageChangeListener(imageViewPagerOnPageChangeListener);
    mVolumePricingExpandableButton.setOnClickListener(expandableLayoutListener);
    mProductDetailExpandableButton.setOnClickListener(
            new ExpandablePanelListener(mProductDetailExpandableButton, mProductDetailExpandableText));
    mDeliveryExpandableButton.setOnClickListener(
            new ExpandablePanelListener(mDeliveryExpandableButton, mDeliveryExpandableText));
    mQuantityEditText.setOnFocusChangeListener(quantityEditTextListener);
    mAddToCartButton.setOnClickListener(addToCartButtonListener);

    mProductDetailVariantSpinner1.setOnItemSelectedListener(getVariantSpinnerListener());
    mProductDetailVariantSpinner2.setOnItemSelectedListener(getVariantSpinnerListener());
    mProductDetailVariantSpinner3.setOnItemSelectedListener(getVariantSpinnerListener());

    mSpinnersVariants = new ArrayList<>();
    mSpinnersVariants.add(mProductDetailVariantSpinner1);
    mSpinnersVariants.add(mProductDetailVariantSpinner2);
    mSpinnersVariants.add(mProductDetailVariantSpinner3);

    mQuantityEditText.addTextChangedListener(quantityEditTextTextWatcher);
    mQuantityEditText.setOnEditorActionListener(new SubmitListener() {
        @Override
        public void onSubmitAction() {
            addToCart();
        }
    });

    // When clicking outside a EditText, hide keyboard, remove focus and
    // reset to the default value
    // Clicking on the main view
    view.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            UIUtils.hideKeyboard(getActivity());
            mQuantityEditText.clearFocus();
            v.performClick();
            return false;
        }
    });

    Intent intentCaller = getActivity().getIntent();

    // Query object to get the products details
    mQueryProduct = new QueryProduct();

    if (intentCaller.hasExtra(IntentConstants.PRODUCT_CODE)) {
        mQueryProduct.setCode(getActivity().getIntent().getStringExtra(IntentConstants.PRODUCT_CODE));
    } else if (StringUtils.equals(intentCaller.getAction(), Intent.ACTION_VIEW)) {
        mQueryProduct.setCode(RegexUtils.getProductCode(intentCaller.getDataString()));
    }

    // Restore the current spinner selection
    if (savedInstanceState != null) {
        if (savedInstanceState.containsKey(SAVED_INSTANCE_PRODUCT_CODE)) {
            mQueryProduct.setCode(savedInstanceState.getString(SAVED_INSTANCE_PRODUCT_CODE, null));
        }
    }

    mProductLoader = getProductLoader(getActivity(), CommerceApplication.getContentServiceHelper(),
            mQueryProduct, new OnRequestListener() {

                @Override
                public void beforeRequest() {
                    afterBeforeRequest(true);
                }

                @Override
                public void afterRequestBeforeResponse() {

                }

                @Override
                public void afterRequest(boolean isDataSynced) {
                    afterBeforeRequest(false);
                }
            });

    return view;
}

From source file:ca.rmen.android.poetassistant.main.PagerAdapter.java

PagerAdapter(Context context, FragmentManager fm, Intent intent) {
    super(fm);/*from   w  w  w  . j a  va2  s. c  o m*/
    Log.v(TAG, "Constructor: intent = " + intent);
    mContext = context;
    Uri initialQuery = intent.getData();
    // Deep link to query in a specific tab
    if (initialQuery != null) {
        Tab tab = Tab.parse(initialQuery.getHost());
        if (tab == Tab.PATTERN) {
            mInitialPatternQuery = initialQuery.getLastPathSegment();
        } else if (tab == Tab.RHYMER) {
            mInitialRhymeQuery = initialQuery.getLastPathSegment();
        } else if (tab == Tab.THESAURUS) {
            mInitialThesaurusQuery = initialQuery.getLastPathSegment();
        } else if (tab == Tab.DICTIONARY) {
            mInitialDictionaryQuery = initialQuery.getLastPathSegment();
        } else if (Constants.DEEP_LINK_QUERY.equals(initialQuery.getHost())) {
            mInitialRhymeQuery = initialQuery.getLastPathSegment();
            mInitialThesaurusQuery = initialQuery.getLastPathSegment();
            mInitialDictionaryQuery = initialQuery.getLastPathSegment();
        }
    }
    // Text shared from another app:
    else if (Intent.ACTION_SEND.equals(intent.getAction())) {
        mInitialPoemText = intent.getStringExtra(Intent.EXTRA_TEXT);
    }
}