List of usage examples for android.content Intent getIntExtra
public int getIntExtra(String name, int defaultValue)
From source file:com.rfo.basic.Web.java
@Override protected void onCreate(Bundle savedInstanceState) { Log.v(LOGTAG, "onCreate"); super.onCreate(savedInstanceState); ContextManager cm = Basic.getContextManager(); cm.registerContext(ContextManager.ACTIVITY_WEB, this); cm.setCurrent(ContextManager.ACTIVITY_WEB); setContentView(R.layout.web);/*from w ww . ja v a 2s . co m*/ View v = findViewById(R.id.web_engine); Intent intent = getIntent(); int showStatusBar = intent.getIntExtra(EXTRA_SHOW_STATUSBAR, 0); int orientation = intent.getIntExtra(EXTRA_ORIENTATION, -1); showStatusBar = (showStatusBar == 0) ? WindowManager.LayoutParams.FLAG_FULLSCREEN // do not show status bar : WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN; // show status bar getWindow().setFlags(showStatusBar, showStatusBar); setOrientation(orientation); engine = (WebView) v; WebSettings webSettings = engine.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setBuiltInZoomControls(true); webSettings.setSupportZoom(true); webSettings.setAppCacheEnabled(true); webSettings.setDatabaseEnabled(true); webSettings.setDomStorageEnabled(true); webSettings.setAllowFileAccess(true); webSettings.setGeolocationEnabled(true); webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); engine.addJavascriptInterface(new JavaScriptInterface(), "Android"); engine.setWebViewClient(new MyWebViewClient()); aWebView = new TheWebView(this); engine.setWebChromeClient(new WebChromeClient() { @Override public boolean onJsAlert(WebView view, String url, String message, JsResult result) { //Required functionality here return super.onJsAlert(view, url, message, result); } }); }
From source file:com.burnevsky.firu.TranslationsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_translations); // Instantiate a ViewPager and a PagerAdapter. TranslationsPagerAdapter mPagerAdapter = new TranslationsPagerAdapter(getSupportFragmentManager()); ViewPager mPager = (ViewPager) findViewById(R.id.ta_pager); mPager.setAdapter(mPagerAdapter);//from ww w . j a v a2 s . com Intent intent = getIntent(); List<Word> mWordList = intent.getParcelableArrayListExtra(INTENT_EXTRA_WORD_LIST); if (mWordList == null) { Log.d("firu", "TranslationsActivity: Unsupported intent given"); finish(); } int mWordIndex = intent.getIntExtra(TranslationsActivity.INTENT_EXTRA_WORD_IDX, 0); for (Word word : mWordList) { mFragments.add(createFragment(word)); } mPagerAdapter.notifyDataSetChanged(); mPager.setCurrentItem(mWordIndex); }
From source file:com.androidquery.simplefeed.PQuery.java
public void forward(FragmentActivity act, int requestCode, int resultCode, Intent data) { if (data == null) return;//from www . j av a 2 s .co m String method = data.getStringExtra(FW_CB); AQUtility.debug("being forwarded!", method); if (method == null) return; int id = data.getIntExtra(FW_ID, -1); if (id != -1) { Fragment f = act.getSupportFragmentManager().findFragmentById(id); AQUtility.debug("fr", f); if (f != null) { AQUtility.invokeHandler(f, method, false, true, FW_SIG, requestCode, resultCode, data); } } }
From source file:com.actinarium.rhythm.control.RhythmNotificationService.java
@Override protected void onHandleIntent(Intent intent) { if (intent != null) { final String action = intent.getAction(); if (ACTION_SHOW_QUICK_CONTROL.equals(action)) { final int notificationId = intent.getIntExtra(EXTRA_NOTIFICATION_ID, Integer.MIN_VALUE); handleShowNotification(notificationId); } else if (ACTION_NEXT_OVERLAY.equals(action)) { handleNextOverlay();/*from w ww . j a v a 2 s .c o m*/ } else if (ACTION_NEXT_GROUP.equals(action)) { handleNextGroup(); } else if (ACTION_DISMISS_QUICK_CONTROL.equals(action)) { handleDismissQuickConfig(); } } }
From source file:com.cuddlesoft.nori.ImageViewerActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get shared preferences. sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); // Get data out of Intent sent by SearchActivity or restore them from the saved instance // state.// w w w . j a va 2s . c o m int imageIndex; if (savedInstanceState != null && savedInstanceState.containsKey(BUNDLE_ID_IMAGE_INDEX) && savedInstanceState.containsKey(BUNDLE_ID_SEARCH_RESULT)) { imageIndex = savedInstanceState.getInt(BUNDLE_ID_IMAGE_INDEX); searchResult = savedInstanceState.getParcelable(BUNDLE_ID_SEARCH_RESULT); searchClient = ((SearchClient.Settings) savedInstanceState .getParcelable(BUNDLE_ID_SEARCH_CLIENT_SETTINGS)).createSearchClient(); } else { final Intent intent = getIntent(); imageIndex = intent.getIntExtra(SearchActivity.BUNDLE_ID_IMAGE_INDEX, 0); searchResult = intent.getParcelableExtra(SearchActivity.BUNDLE_ID_SEARCH_RESULT); searchClient = ((SearchClient.Settings) intent .getParcelableExtra(SearchActivity.BUNDLE_ID_SEARCH_CLIENT_SETTINGS)).createSearchClient(); } // Request window features. supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); // Keep screen on, if enabled by the user. if (sharedPreferences.getBoolean(getString(R.string.preference_image_viewer_keepScreenOn_key), true)) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } // Populate content view. setContentView(R.layout.activity_image_viewer); // Set up the action bar. final ActionBar actionBar = getSupportActionBar(); actionBar.hide(); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayHomeAsUpEnabled(true); // Create and set the image viewer Fragment pager adapter. imagePagerAdapter = new ImagePagerAdapter(getSupportFragmentManager()); viewPager = (ImageViewerPager) findViewById(R.id.image_pager); viewPager.setAdapter(imagePagerAdapter); viewPager.setOnPageChangeListener(this); viewPager.setCurrentItem(imageIndex); // Set up the GestureDetector used to toggle the action bar. gestureDetector = new GestureDetector(this, gestureListener); viewPager.setOnMotionEventListener(this); // Set activity title. setTitle(searchResult.getImages()[imageIndex]); // Dim system UI. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { viewPager.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE); } }
From source file:com.dashihui.afford.ui.activity.AtyFragmentServerDetail.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.aty_frag_server_detail); //????//from ww w .java2 s . co m mAtyHouseTpye = getIntent().getStringExtra(AtySettlementOrder.ORDER_PAY_TYPE); //?? mOrderCode = getIntent().getStringExtra(AtySettlementOrder.ORDER_CODE); mTopTitle_txt = (TextView) findViewById(R.id.title); mTopTitle_txt.setText(""); mRightPhone = (ImageButton) findViewById(R.id.top_btn_right); mRightPhone.setVisibility(View.VISIBLE); mRightPhone.setImageResource(R.drawable.icon_phone); mRightPhone.setOnClickListener(this); mIbtnBack = (ImageButton) findViewById(R.id.ibtnBack); mIbtnBack.setOnClickListener(this); tabs = (WdtPagerSlidingTabStrip) findViewById(R.id.apps_fragment_tabs); pager = (ViewPager) findViewById(R.id.apps_fragment_viewpager); Intent intent = getIntent(); //??1 2 ?? ???searchClassifyType mSearchClassifyType = intent.getIntExtra("searchClassifyType", -1); adapter = new MyPagerAdapter(getSupportFragmentManager()); // ???N?? pager.setOffscreenPageLimit(adapter.getCount()); pager.setAdapter(adapter); final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, getResources().getDisplayMetrics()); pager.setPageMargin(pageMargin); pager.setCurrentItem(intent.getIntExtra(TABCODE, 0)); tabs.setViewPager(pager); changeColor(currentColor); }
From source file:net.gcompris.GComprisActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK && data != null && requestCode == 1001) { int responseCode = data.getIntExtra("RESPONSE_CODE", -1); String purchaseData = data.getStringExtra("INAPP_PURCHASE_DATA"); try {// w w w. j a v a 2 s.c o m JSONObject jo = new JSONObject(purchaseData); String sku = jo.getString("productId"); int purchaseState = jo.getInt("purchaseState"); String payload = jo.getString("developerPayload"); String purchaseToken = jo.getString("purchaseToken"); if (sku.equals(SKU_NAME) && purchaseState == 0) { bought(true); return; } } catch (Exception e) { e.printStackTrace(); } Log.e(QtApplication.QtTAG, "Buying full version failed: Result code == " + resultCode); } }
From source file:com.irontec.mintzatu.EzarpenakDetailActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); mContext = getBaseContext();/* w ww . j a v a 2s. c o m*/ Intent intent = getIntent(); if (intent != null) { mType = intent.getIntExtra("detail_type", 0); } if (mType == 0) { loadSocialNetworks(); getSupportActionBar().setTitle(mContext.getResources().getString(R.string.ezarpenak_sare_sozialak)); twCheck = (CheckBox) findViewById(R.id.twCheck); fbCheck = (CheckBox) findViewById(R.id.fbCheck); mSimpleFacebook = FacebookHelper.getSimpleFacebookInstance(this); if (mSimpleFacebook.isLogin()) { fbCheck.setChecked(true); } else { fbCheck.setChecked(false); } if (TwitterHelper.isConnected(mContext)) { twCheck.setChecked(true); } else { twCheck.setChecked(false); } twCheck.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (!twCheck.isChecked()) { TwitterHelper.disconnectTwitter(mContext); twCheck.setChecked(false); } else { new Thread(new Runnable() { public void run() { askOAuth(); twCheck.setChecked(true); } }).start(); } } }); fbCheck.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (!fbCheck.isChecked()) { mSimpleFacebook.logout(onLogoutListener); fbCheck.setChecked(false); } else { mSimpleFacebook.login(mOnLoginListener); } } }); } else if (mType == 1) { loadLicensesLayout(); getSupportActionBar().setTitle(mContext.getResources().getString(R.string.ezarpenak_lizentziak)); mLicenseList = (ListView) findViewById(R.id.license_list); ArrayList<BasicNameValuePair> values = new ArrayList<BasicNameValuePair>(); BasicNameValuePair license1 = new BasicNameValuePair("Android Open Source Project", "http://source.android.com"); BasicNameValuePair license2 = new BasicNameValuePair("Twitter4J", "http://twitter4j.org"); BasicNameValuePair license3 = new BasicNameValuePair("android-async-http", "http://loopj.com/android-async-http/"); BasicNameValuePair license4 = new BasicNameValuePair("Picasso", "http://square.github.io/picasso/"); BasicNameValuePair license5 = new BasicNameValuePair("Apache HttpComponents", "http://hc.apache.org/"); BasicNameValuePair license6 = new BasicNameValuePair("android-simple-facebook", "https://github.com/sromku/android-simple-facebook#login-1"); BasicNameValuePair license7 = new BasicNameValuePair("android-protips-location", "https://code.google.com/p/android-protips-location/source/browse/trunk/src/com/radioactiveyak/location_best_practices/utils/base/ILastLocationFinder.java?r=3"); values.add(license1); values.add(license2); values.add(license3); values.add(license4); values.add(license5); values.add(license6); values.add(license7); mLicenseList.setAdapter(new SimpleLicenseAdapter(mContext, values)); mLicenseList.setOnItemClickListener(EzarpenakDetailActivity.this); } }
From source file:com.actionbarsherlock.sample.demos.content.LocalServiceBroadcaster.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.local_service_broadcaster); // This is where we print the data we get back. final TextView callbackData = (TextView) findViewById(R.id.callback); // Put in some initial text. callbackData.setText("No broadcast received yet"); // We use this to send broadcasts within our local process. mLocalBroadcastManager = LocalBroadcastManager.getInstance(this); // We are going to watch for interesting local broadcasts. IntentFilter filter = new IntentFilter(); filter.addAction(ACTION_STARTED);/* w w w. j a v a 2 s .c o m*/ filter.addAction(ACTION_UPDATE); filter.addAction(ACTION_STOPPED); mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(ACTION_STARTED)) { callbackData.setText("STARTED"); } else if (intent.getAction().equals(ACTION_UPDATE)) { callbackData.setText("Got update: " + intent.getIntExtra("value", 0)); } else if (intent.getAction().equals(ACTION_STOPPED)) { callbackData.setText("STOPPED"); } } }; mLocalBroadcastManager.registerReceiver(mReceiver, filter); // Watch for button clicks. Button button = (Button) findViewById(R.id.start); button.setOnClickListener(mStartListener); button = (Button) findViewById(R.id.stop); button.setOnClickListener(mStopListener); }
From source file:no.firestorm.weathernotificatonservice.WeatherNotificationService.java
@Override protected void onHandleIntent(Intent intent) { switch (intent.getIntExtra(INTENT_EXTRA_ACTION, INTENT_EXTRA_ACTION_GET_TEMP)) { case INTENT_EXTRA_ACTION_GET_TEMP: showTemp();/*from w w w . jav a2 s . c om*/ break; case INTENT_EXTRA_ACTION_UPDATE_ALARM: updateAlarm(); break; default: showTemp(); break; } }