List of usage examples for android.os Bundle getInt
public int getInt(String key, int defaultValue)
From source file:edu.umich.oasis.sandbox.SandboxService.java
@Override public IBinder onBind(Intent i) { if (localLOGD) { Log.d(TAG, "Bound"); }/* w w w . j av a2 s . c o m*/ Bundle extras = i.getExtras(); if (extras == null) { throw new IllegalArgumentException("No extras"); } IBinder api = extras.getBinder(EXTRA_TRUSTED_API); if (api == null) { throw new IllegalArgumentException("Trusted API not found in extras"); } IBinder root = extras.getBinder(EXTRA_ROOT_SERVICE); if (root == null) { throw new IllegalArgumentException("OASISService not found in extras"); } mTrustedAPI = ITrustedAPI.Stub.asInterface(api); mRootService = IOASISService.Stub.asInterface(root); mID = extras.getInt(EXTRA_SANDBOX_ID, -1); if (localLOGV) { ClassLoader cl = getClassLoader(); Log.v(TAG, "ClassLoader chain:"); while (cl != null) { Log.v(TAG, cl.toString()); cl = cl.getParent(); } Log.v(TAG, "<end of chain>"); } final String[] packagesToLoad = extras.getStringArray(EXTRA_KNOWN_PACKAGES); getBackgroundHandler().post(new Runnable() { @Override public void run() { if (localLOGD) { Log.d(TAG, "Preloading resolve code"); } // Run through a fake transaction, to preload the appropriate classes. SodaDescriptor preloadDesc = SodaDescriptor.forStatic(SandboxService.this, SandboxService.class, "resolveStub"); Binder testBinder = new Binder() { @Override protected boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException { return mBinder.onTransact(code, data, reply, flags); } }; testBinder.attachInterface(null, ""); ISandboxService proxy = ISandboxService.Stub.asInterface(testBinder); try { proxy.resolveSoda(preloadDesc, false, null); } catch (Exception e) { Log.w(TAG, "Couldn't preload resolve", e); } if (localLOGD) { Log.d(TAG, "Preloading packages"); } // Load up packages the trusted service tells us we might need. for (String packageName : ArrayUtils.nullToEmpty(packagesToLoad)) { try { if (localLOGD) { Log.d(TAG, "Preloading " + packageName); } getContextForPackage(packageName); } catch (PackageManager.NameNotFoundException e) { Log.w(TAG, "Can't preload package", e); } } Log.i(TAG, "Sandbox #" + mID + ": preload complete"); } }); return mBinder; }
From source file:edu.umich.flowfence.sandbox.SandboxService.java
@Override public IBinder onBind(Intent i) { if (localLOGD) { Log.d(TAG, "Bound"); }//from w w w.j av a 2 s.c o m Bundle extras = i.getExtras(); if (extras == null) { throw new IllegalArgumentException("No extras"); } IBinder api = extras.getBinder(EXTRA_TRUSTED_API); if (api == null) { throw new IllegalArgumentException("Trusted API not found in extras"); } IBinder root = extras.getBinder(EXTRA_ROOT_SERVICE); if (root == null) { throw new IllegalArgumentException("FlowfenceService not found in extras"); } mTrustedAPI = ITrustedAPI.Stub.asInterface(api); mRootService = IFlowfenceService.Stub.asInterface(root); mID = extras.getInt(EXTRA_SANDBOX_ID, -1); if (localLOGV) { ClassLoader cl = getClassLoader(); Log.v(TAG, "ClassLoader chain:"); while (cl != null) { Log.v(TAG, cl.toString()); cl = cl.getParent(); } Log.v(TAG, "<end of chain>"); } final String[] packagesToLoad = extras.getStringArray(EXTRA_KNOWN_PACKAGES); getBackgroundHandler().post(new Runnable() { @Override public void run() { if (localLOGD) { Log.d(TAG, "Preloading resolve code"); } // Run through a fake transaction, to preload the appropriate classes. QMDescriptor preloadDesc = QMDescriptor.forStatic(SandboxService.this, SandboxService.class, "resolveStub"); Binder testBinder = new Binder() { @Override protected boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException { return mBinder.onTransact(code, data, reply, flags); } }; testBinder.attachInterface(null, ""); ISandboxService proxy = ISandboxService.Stub.asInterface(testBinder); try { proxy.resolveQM(preloadDesc, false, null); } catch (Exception e) { Log.w(TAG, "Couldn't preload resolve", e); } if (localLOGD) { Log.d(TAG, "Preloading packages"); } // Load up packages the trusted service tells us we might need. for (String packageName : ArrayUtils.nullToEmpty(packagesToLoad)) { try { if (localLOGD) { Log.d(TAG, "Preloading " + packageName); } getContextForPackage(packageName); } catch (PackageManager.NameNotFoundException e) { Log.w(TAG, "Can't preload package", e); } } Log.i(TAG, "Sandbox #" + mID + ": preload complete"); } }); return mBinder; }
From source file:com.brodev.socialapp.view.ImagePagerActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY); ColorDrawable color = new ColorDrawable(Color.TRANSPARENT); color.setAlpha(128);/*from www .ja va2s. c o m*/ getSupportActionBar().setBackgroundDrawable(color); getSupportActionBar().setDisplayHomeAsUpEnabled(true); setContentView(R.layout.ac_image_pager); File cacheDir = new File(this.getCacheDir(), "imgcachedir"); if (!cacheDir.exists()) cacheDir.mkdir(); // phrase manager phraseManager = new PhraseManager(getApplicationContext()); Bundle bundle = getIntent().getExtras(); String[] imageUrls = bundle.getStringArray("image"); String[] imagesId = bundle.getStringArray("photo_id"); String[] HasLike = bundle.getStringArray("HasLike"); String[] FeedisLike = bundle.getStringArray("FeedisLike"); String[] Total_like = bundle.getStringArray("Total_like"); String[] Total_comment = bundle.getStringArray("Total_comment"); String[] Itemid = bundle.getStringArray("Itemid"); String[] Type = bundle.getStringArray("Type"); int pagerPosition = bundle.getInt("position", 0); if (savedInstanceState != null) { pagerPosition = savedInstanceState.getInt(STATE_POSITION); } pager = (ViewPager) findViewById(R.id.pager); pager.setAdapter(new ImagePagerAdapter(this, imageUrls, imagesId, HasLike, FeedisLike, Total_like, Total_comment, Itemid, Type)); pager.setOffscreenPageLimit(2); pager.setCurrentItem(pagerPosition); this.getWindow().setBackgroundDrawableResource(android.R.color.transparent); }
From source file:com.soomla.example.ExampleSocialActivity.java
/** * {@inheritDoc}/* w ww . jav a2 s . c o m*/ */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_social); // SoomlaConfig.logDebug = true; mProgressDialog = new ProgressDialog(this); final Bundle extras = getIntent().getExtras(); if (extras != null) { final String provider = extras.getString("provider"); mProvider = IProvider.Provider.getEnum(provider); mItemId = extras.getString("id"); mItemAmount = extras.getInt("amount", 1); mItemName = extras.getString("name"); mItemResId = extras.getInt("iconResId", R.drawable.ic_launcher); // set the social provider logo if possible final int resourceId = getResources().getIdentifier(provider, "drawable", getPackageName()); Drawable drawableLogo = getResources().getDrawable(resourceId); if (drawableLogo != null) { final TextView topBarTextView = (TextView) findViewById(R.id.textview); if (topBarTextView != null) { topBarTextView.setCompoundDrawablesWithIntrinsicBounds(drawableLogo, null, null, null); } } } final TextView vItemDisplay = (TextView) findViewById(R.id.vItem); if (vItemDisplay != null) { vItemDisplay.setText(mItemName); vItemDisplay.setCompoundDrawablesWithIntrinsicBounds(null, getResources().getDrawable(mItemResId), null, null); } mProfileBar = (ViewGroup) findViewById(R.id.profile_bar); mProfileAvatar = (ImageView) findViewById(R.id.prof_avatar); mProfileName = (TextView) findViewById(R.id.prof_name); mPnlStatusUpdate = (ViewGroup) findViewById(R.id.pnlStatusUpdate); mEdtStatusText = (EditText) findViewById(R.id.edtStatusText); mEdtStatusText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { boolean handled = false; if (actionId == EditorInfo.IME_ACTION_SEND) { doUpdateStatus(); handled = true; } return handled; } }); mBtnUpdateStatus = (Button) findViewById(R.id.btnStatusUpdate); mBtnUpdateStatus.setEnabled(false); mBtnUpdateStatus.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { doUpdateStatus(); } }); mPnlUploadImage = (ViewGroup) findViewById(R.id.pnlUploadImage); mImagePreview = (ImageView) findViewById(R.id.imagePreview); mEdtImageText = (EditText) findViewById(R.id.edtImageText); mEdtImageText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { boolean handled = false; if (actionId == EditorInfo.IME_ACTION_SEND) { doUpdateStatus(); handled = true; } return handled; } }); mBtnChooseImage = (ImageView) findViewById(R.id.btnChooseImage); mBtnChooseImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { chooseImageFile(); } }); mBtnUploadImage = (Button) findViewById(R.id.btnUploadImage); mBtnUploadImage.setEnabled(false); mBtnUploadImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { doUploadImage(); } }); mPnlStoryUpdate = (ViewGroup) findViewById(R.id.pnlStoryUpdate); mEdtStoryText = (EditText) findViewById(R.id.edtStoryText); mEdtStoryText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { boolean handled = false; if (actionId == EditorInfo.IME_ACTION_SEND) { doUpdateStory(); handled = true; } return handled; } }); mBtnUpdateStory = (Button) findViewById(R.id.btnStoryUpdate); mBtnUpdateStory.setEnabled(false); mBtnUpdateStory.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { doUpdateStory(); } }); mBtnShare = (Button) findViewById(R.id.btnShare); if (!SoomlaProfile.getInstance().isLoggedIn(this, mProvider)) { SoomlaProfile.getInstance().login(this, mProvider, gameLoginReward); mProgressDialog.setMessage("logging in..."); mProgressDialog.show(); } else { applyLoggedInUser(mProvider); } }
From source file:gov.whitehouse.ui.fragments.app.ArticleViewerFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); Bundle args = getArguments(); mPageInfo = new JSONObject(); try {// w w w .j a v a2 s . co m mPageInfo.put("title", args.getString("title")); final SimpleDateFormat date = new SimpleDateFormat("MMM d, yyyy h:mm a"); final DateFormat parse = DateFormat.getDateTimeInstance(); mPageInfo.put("date", date.format(parse.parse(args.getString("date")))); mPageInfo.put("creator", args.getString("creator")); mPageInfo.put("description", args.getString("description")); mPageInfo.put("url", args.getString("url")); mWebView.loadUrl(PAGE_TEMPLATE_URL); } catch (JSONException e) { Log.e(TAG, "error creating JSON object for post", e); } catch (ParseException e) { } mArticleType = args.getInt(ARG_FEED_TYPE, ARTICLE_TYPE_FEED); mUpTitle = args.getString(ARG_UP_TITLE); if (!((BaseActivity) getSherlockActivity()).isMultipaned()) { switch (mArticleType) { case ARTICLE_TYPE_FEED: getSherlockActivity().getSupportActionBar().setTitle(mUpTitle.toUpperCase()); break; case ARTICLE_TYPE_FAVORITES: getSherlockActivity().getSupportActionBar().setTitle(R.string.favorites); break; } } final String json = args.getString(ARG_ITEM_JSON); if (json != null) { mFeedItem = GsonUtils.fromJson(json, FeedItem.class); } mFavorited = FavoritesUtils.isFavorited(getSherlockActivity(), mFeedItem); }
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 .ja v a2 s. c o m*/ 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:com.dvdprime.mobile.android.ui.DocumentViewActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.Theme_Sherlock_Light); requestWindowFeature(Window.FEATURE_PROGRESS); super.onCreate(savedInstanceState); // Initialize WebView mWebView = new DpWebView(this); mWebView.setId(mWebView.hashCode()); mWebView.setOnCreateContextMenuListener(this); // Initialize Ad. mAdManager = new DpAdManager(); mAdManager.onCreate(this); mLayout = new RelativeLayout(this); mAdView = new DpAdViewCore(this); mAdView.setId(mAdView.hashCode());//from ww w .ja v a2 s. c o m RelativeLayout.LayoutParams layoutParams1 = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); layoutParams1.addRule(RelativeLayout.ABOVE, mAdView.getId()); mLayout.addView(mWebView, layoutParams1); RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); layoutParams2.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); mLayout.addView(mAdView, layoutParams2); mAdManager.bindCoreView(mAdView); setContentView(mLayout); // Initialize pull to refresh mPullToRefreshAttacher = PullToRefreshAttacher.get(this); mPullToRefreshAttacher.addRefreshableView(mWebView, this); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { mLayout.findViewById(mAdView.getId()).setVisibility(View.GONE); } this.overridePendingTransition(R.anim.start_enter, R.anim.start_exit); this.mActivity = this; Bundle bundle = getIntent().getExtras(); if (bundle != null) { try { index = bundle.getInt("index", 0); Document doc = (Document) DpApp.getDocumentList().get(this.index); getSupportActionBar().setTitle(doc.getUserName()); getSupportActionBar().setSubtitle(doc.getTitle()); mUrl = Config.getAbsoluteUrl("/bbs" + doc.getUrl()); } catch (Exception e) { } } Uri uri = getIntent().getData(); if (uri != null) { this.mUrl = uri.toString(); if (getIntent().getExtras().getString("targetKey") != null) { mTargetKey = getIntent().getExtras().getString("targetKey"); } } if (StringUtil.isBlank(this.mUrl)) { finish(); } getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayUseLogoEnabled(true); // Initialize EventBus EventBusProvider.getInstance().register(this, String.class, new Class[] { Refresh.class }); // Request Document View StringRequest req = new StringRequest(0, this.mUrl, createReqSuccessListener(), createReqErrorListener()); req.setTag(this.TAG); DpApp.getRequestQueue().add(req); // Initialize Google Analytics EasyTracker.getInstance().setContext(this.mActivity); EasyTracker.getTracker().sendView("DocView"); LogUtil.LOGD("Tracker", "DocView"); }
From source file:com.repkap11.repcast.activities.LocalPlayerActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.player_activity); mAquery = new AQuery(this); loadViews();//from w ww.j a v a 2 s. c o m mCastManager = VideoCastManager.getInstance(); mCastManager.setCastControllerImmersive(false); setupControlsCallbacks(); setupCastListener(); String castPath; String mimeType = getIntent().getType(); String title = getIntent().getStringExtra(Intent.EXTRA_TITLE); int trackType; int mediaType; if (mimeType.equals("video/mp4")) { trackType = MediaTrack.TYPE_VIDEO; mediaType = MediaMetadata.MEDIA_TYPE_MOVIE; } else if (mimeType.equals("audio/mpeg")) { } else { trackType = MediaTrack.TYPE_UNKNOWN; mediaType = MediaMetadata.MEDIA_TYPE_GENERIC; } trackType = MediaTrack.TYPE_VIDEO; mediaType = MediaMetadata.MEDIA_TYPE_MOVIE; try { URL url = new URI(getIntent().getDataString()).toURL(); castPath = url.toExternalForm(); if (title == null) { title = new File(url.getPath()).getName(); } } catch (MalformedURLException | URISyntaxException e) { e.printStackTrace(); finish(); return; } Log.e(TAG, "Cast Path:" + castPath); MediaInfo.Builder builder = new MediaInfo.Builder(castPath); builder.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED); builder.setContentType(mimeType); MediaMetadata metadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MUSIC_TRACK); metadata.putString(MediaMetadata.KEY_TITLE, title); //metadata.putString(MediaMetadata.KEY_SUBTITLE, "Sub title Text"); builder.setMetadata(metadata); JSONObject jsonObj = null; try { jsonObj = new JSONObject(); jsonObj.put(VideoProvider.KEY_DESCRIPTION, ""); } catch (JSONException e) { Log.e(TAG, "Failed to add description to the json object", e); } MediaTrack.Builder trackBuilder = new MediaTrack.Builder(1, MediaTrack.TYPE_VIDEO); //trackBuilder.setContentId(castPath); Log.e(TAG, "Setting path String: " + castPath); trackBuilder.setName(title); builder.setMediaTracks(Collections.singletonList(trackBuilder.build())); builder.setCustomData(jsonObj); mSelectedMedia = builder.build(); setupActionBar(); Bundle b = getIntent().getExtras(); boolean shouldStartPlayback = false; int startPosition = 0; if (b != null) { shouldStartPlayback = b.getBoolean("shouldStart", false); startPosition = b.getInt("startPosition", 0); } mVideoView.setVideoURI(Uri.parse(mSelectedMedia.getContentId())); Log.e(TAG, "Setting url of the VideoView to: " + Uri.parse(mSelectedMedia.getContentId())); if (shouldStartPlayback) { // this will be the case only if we are coming from the // CastControllerActivity by disconnecting from a device mPlaybackState = PlaybackState.PLAYING; updatePlaybackLocation(PlaybackLocation.LOCAL); updatePlayButton(mPlaybackState); if (startPosition > 0) { mVideoView.seekTo(startPosition); } mVideoView.start(); startControllersTimer(); } else { // we should load the video but pause it // and show the album art. if (mCastManager.isConnected()) { updatePlaybackLocation(PlaybackLocation.REMOTE); } else { updatePlaybackLocation(PlaybackLocation.LOCAL); } mPlaybackState = PlaybackState.IDLE; updatePlayButton(mPlaybackState); } if (null != mTitleView) { updateMetadata(true); } }
From source file:com.dwdesign.tweetings.fragment.UserListDetailsFragment.java
@Override public void onActivityCreated(final Bundle savedInstanceState) { mService = getApplication().getServiceInterface(); mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE); super.onActivityCreated(savedInstanceState); final Bundle args = getArguments(); long account_id = -1, user_id = -1; int list_id = -1; String screen_name = null, list_name = null; if (args != null) { account_id = args.getLong(INTENT_KEY_ACCOUNT_ID, -1); user_id = args.getLong(INTENT_KEY_USER_ID, -1); list_id = args.getInt(INTENT_KEY_LIST_ID, -1); list_name = args.getString(INTENT_KEY_LIST_NAME); screen_name = args.getString(INTENT_KEY_SCREEN_NAME); }/*from w ww . j a va2 s .c om*/ mProfileImageLoader = getApplication().getImageLoaderWrapper(); mAdapter = new ListActionAdapter(getActivity()); mAdapter.add(new ListTimelineAction()); mAdapter.add(new ListMembersAction()); mAdapter.add(new ListSubscribersAction()); mProfileImageContainer.setOnClickListener(this); mProfileImageContainer.setOnLongClickListener(this); mNameContainer.setOnClickListener(this); mNameContainer.setOnLongClickListener(this); mFollowMoreButton.setOnClickListener(this); mRetryButton.setOnClickListener(this); setListAdapter(null); mListView = getListView(); mListView.addHeaderView(mHeaderView, null, false); mListView.setOnItemClickListener(this); mListView.setOnItemLongClickListener(this); setListAdapter(mAdapter); getUserListInfo(true, account_id, list_id, list_name, user_id, screen_name); }
From source file:com.alexskyy.gplusauthtest.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // setContentView(R.layout.main_activity); // sign_in_button = (SignInButton) findViewById(R.id.sign_in_button); // sign_out_button = (Button) findViewById(R.id.sign_out_button); // revoke_access_button = (Button) findViewById(R.id.revoke_access_button); // sign_in_status = (TextView) findViewById(R.id.sign_in_status); // circles_list = (ListView) findViewById(R.id.circles_list); if (savedInstanceState != null) { mSignInProgress = savedInstanceState.getInt(SAVED_PROGRESS, STATE_DEFAULT); }//ww w .j a v a 2 s .c om }