Example usage for android.os Bundle get

List of usage examples for android.os Bundle get

Introduction

In this page you can find the example usage for android.os Bundle get.

Prototype

@Nullable
public Object get(String key) 

Source Link

Document

Returns the entry with the given key as an object.

Usage

From source file:com.gemapps.saidit.ui.toplisting.TopListingFragment.java

private void rebuildState(Bundle savedInstanceState) {
    if (savedInstanceState.containsKey(LISTING_LIST_PREF)) {
        ArrayList<TopListingItem> listingItems = (ArrayList<TopListingItem>) savedInstanceState
                .get(LISTING_LIST_PREF);

        if (listingItems != null && listingItems.size() > 0)
            onPopulateList(listingItems);
        else// w  ww. j av  a  2s  .  c om
            mInteractionListener.loadBasicListing();
    } else {
        mInteractionListener.loadBasicListing();
    }
}

From source file:it.angelic.soulissclient.TagDetailActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    opzioni = SoulissApp.getOpzioni();//from   w ww.ja va 2s .c  o  m

    db = new SoulissDBTagHelper(this);
    if (opzioni.isLightThemeSelected())
        setTheme(R.style.LightThemeSelector);
    else
        setTheme(R.style.DarkThemeSelector);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_tag_detail);

    Bundle extras = getIntent().getExtras();
    if (extras != null && extras.get("TAG") != null)
        tagId = (long) extras.get("TAG");

    try {
        collected = db.getTag((int) tagId);
    } catch (SQLDataException sql) {
        Log.i(Constants.TAG, "TAGID NOT FOUND: " + tagId);
    }

    if (savedInstanceState == null) {
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        fragment = new TagDetailFragment();
        transaction.replace(R.id.detailPane, fragment);
        transaction.commit();
    }
    /* try {
    setEnterSharedElementCallback(new SharedElementCallback() {
        @Override
        public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) {
            Log.i(Constants.TAG, "EnterSharedElement.onMapSharedElements:" + sharedElements.size());
            //manual override perche il fragment ancora non c'e
            //sharedElements.put("photo_hero", fragment.getView().findViewById(R.id.photo));
            //  sharedElements.put("shadow_hero", fragment.getView().findViewById(R.id.infoAlpha));
            // sharedElements.put("tag_icon", fragment.getView().findViewById(R.id.imageTagIcon));
            super.onMapSharedElements(names, sharedElements);
        }
            
        @Override
        public void onRejectSharedElements(List<View> rejectedSharedElements) {
            Log.i(Constants.TAG, "EnterSharedElement.onMapSharedElements:" + rejectedSharedElements.size());
            super.onRejectSharedElements(rejectedSharedElements);
        }
            
    });
     } catch (Exception uie) {
    Log.e(Constants.TAG, "UIE:" + uie.getMessage());
     }*/
}

From source file:org.zywx.wbpalmstar.platform.push.PushRecieveMsgReceiver.java

private void newPushNotification(Context context, Intent intent) {
    PushReportUtility.log("newPushNotification->isForground = " + EBrowserActivity.isForground);
    Bundle bundle = intent.getExtras();
    PushDataInfo dataInfo = (PushDataInfo) bundle.get(PushReportConstants.PUSH_DATA_INFO_KEY);
    int contentAvailable = dataInfo.getContentAvailable();
    if (contentAvailable == 0 && !EBrowserActivity.isForground) {
        buildPushNotification(context, intent, dataInfo);
    } else {/* ww w  .  j a  v  a2  s. com*/
        if (mContext != null) {
            intent.putExtra("ntype", F_TYPE_PUSH);
            intent.putExtra("data", dataInfo.getAlert());
            intent.putExtra("message", dataInfo.getPushDataString());
            ((EBrowserActivity) mContext).handleIntent(intent);
        }
    }
}

From source file:com.owncloud.activity.Downloader.java

public void downloadFile(Intent i) {
    if (isOnline()) {
        String url = i.getData().toString();
        GetMethod gm = new GetMethod(url);

        try {//www . ja  va 2  s.c  o  m
            int status = BaseActivity.httpClient.executeMethod(gm);
            //            Toast.makeText(getApplicationContext(), String.valueOf(status),2).show();
            Log.e("HttpStatus", "==============>" + String.valueOf(status));
            if (status == HttpStatus.SC_OK) {
                InputStream input = gm.getResponseBodyAsStream();

                String fileName = new StringBuffer(url).reverse().toString();
                String[] fileNameArray = fileName.split("/");
                fileName = new StringBuffer(fileNameArray[0]).reverse().toString();

                fileName = URLDecoder.decode(fileName);
                File folder = new File(BaseActivity.mDownloadDest);
                boolean success = false;
                if (!folder.exists()) {
                    success = folder.mkdir();
                }
                if (!success) {
                    // Do something on success
                    File file = new File(BaseActivity.mDownloadDest, fileName);
                    OutputStream fOut = new FileOutputStream(file);

                    int byteCount = 0;
                    byte[] buffer = new byte[4096];
                    int bytesRead = -1;

                    while ((bytesRead = input.read(buffer)) != -1) {
                        fOut.write(buffer, 0, bytesRead);
                        byteCount += bytesRead;
                        //                     DashBoardActivity.updateNotation();
                    }

                    fOut.flush();
                    fOut.close();
                } else {
                    // Do something else on failure
                    Log.d("Download Prob..", String.valueOf(success) + ", Some problem in folder creating");
                }

            }
        } catch (HttpException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        gm.releaseConnection();

        Bundle extras = i.getExtras();

        if (extras != null) {
            Messenger messenger = (Messenger) extras.get(EXTRA_MESSENGER);
            Message msg = Message.obtain();

            msg.arg1 = Activity.RESULT_OK;

            try {
                messenger.send(msg);
            } catch (android.os.RemoteException e1) {
                Log.w(getClass().getName(), "Exception sending message", e1);
            }
        }
    } else {
        WebNetworkAlert();
    }
}

From source file:gob.sct.android.checatucell.services.LocationReceiver.java

/***
 * Makes a call to the location service and gets current user's location
 * *//*w  w  w . ja va2  s .  c om*/
private Location getLocationUpdate(Bundle mBundle, Intent mIntent) {

    String message;

    Location location = (Location) mBundle.get(LocationPoller.EXTRA_LOCATION);

    if (location == null) {
        location = (Location) mBundle.get(LocationPoller.EXTRA_LASTKNOWN);
        if (location == null) {
            message = mIntent.getStringExtra(LocationPoller.EXTRA_ERROR);
        } else {
            message = "TIMEOUT, lastKnownlocation = " + location.toString();
        }
    } else {
        return location;
    }
    if (message == null)
        message = "Invalid broadcast received!";
    else
        DebugMode.logger(DEBUG_TAG, message);
    return null;
}

From source file:org.alfresco.mobile.android.application.fragments.fileexplorer.LibraryFragment.java

@Override
protected void onRetrieveParameters(Bundle bundle) {
    mediaTypeId = (Integer) bundle.get(ARGUMENT_MEDIATYPE_ID);
    menuId = bundle.getInt(ARGUMENT_MENU_ID);
    isShortCut = bundle.getBoolean(ARGUMENT_SHORTCUT);
}

From source file:com.example.llh_pc.it_support.gcm.MyGcmListenerService.java

/**
 * Called when message is received./*from  w  ww . ja  v a  2 s .  c o  m*/
 *
 * @param from SenderID of the sender.
 * @param data Data bundle containing message data as key/value pairs.
 *             For Set of keys use data.keySet().
 */
// [START receive_message]
@Override
public void onMessageReceived(String from, Bundle data) {
    String message = data.getString("message");
    Log.d(TAG, "From: " + from);
    Log.d(TAG, "Message: " + message);
    Gson gson = new Gson();
    try {
        NotificationParse postParse = gson.fromJson((String) data.get("data"), NotificationParse.class);
        avatar = postParse.getResults().getPost_type().getAvatar();
        name = postParse.getResults().getPost_type().getName();
    } catch (Exception ex) {
        Log.e(ex.toString(), "Looi");
    }
    //        if (from.startsWith("/topics/")) {
    //            // message received from some topic.
    //        } else {
    //            // normal downstream message.
    //        }

    // [START_EXCLUDE]
    /**
     * Production applications would usually process the message here.
     * Eg: - Syncing with server.
     *     - Store message in local database.
     *     - Update UI.
     */

    /**
     * In some cases it may be useful to show a notification indicating to the user
     * that a message was received.
     */
    sendNotification(message, avatar, name);
    // [END_EXCLUDE]
}

From source file:com.cmput301.classproject.UI.AddSubmissionActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_add_submission);
    getActionBar().setDisplayHomeAsUpEnabled(false);

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        task = (Task) extras.get("Task");
        if ((task.getRequires() & Submission.ACCESS_PHOTO) == 0) {
            findViewById(R.id.add_photo_id).setEnabled(false);
        }/* w  w w  .j a  v  a  2 s.c o  m*/
        if ((task.getRequires() & Submission.ACCESS_AUDIO) == 0) {
            findViewById(R.id.add_audio_id).setEnabled(false);
        }
    }

    if (task == null) {
        finish();
    }
}

From source file:fr.outadev.skinswitch.GalleryPageFragment.java

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

    Bundle args = getArguments();

    if (args == null) {
        endPoint = EndPoint.RANDOM_SKINS;
        searchQuery = ".";
    } else {/*from  w  ww .  j  ava 2  s. co  m*/
        endPoint = (EndPoint) args.get(ARG_ENDPOINT);
        searchQuery = args.getString(ARG_SEARCH_QUERY);
    }

    View view = inflater.inflate(R.layout.fragment_skin_gallery_list, container, false);

    progressBar = (ProgressBar) view.findViewById(R.id.progress_bar);
    swipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_container);
    swipeRefreshLayout.setColorSchemeResources(R.color.loading_bar_one, R.color.loading_bar_two,
            R.color.loading_bar_one, R.color.loading_bar_two);
    swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            loadSkinsFromNetwork();
        }

    });

    ListView listView = (ListView) view.findViewById(R.id.skins_library_list);
    skinsList = new ArrayList<GallerySkin>();
    adapter = new GalleryListAdapter(getActivity(), android.R.layout.simple_list_item_1, skinsList);
    listView.setAdapter(adapter);

    listView.setOnScrollListener(
            new EndlessScrollListener(getResources().getInteger(R.integer.endless_scroll_visible_threshold)) {

                @Override
                public void onLoadMore(int page, int totalItemsCount) {
                    loadSkinsFromNetwork(true);
                }

            });

    loadSkinsFromNetwork(false);
    return view;
}

From source file:fragments.DocumentsListFragment.java

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

    mCurrentPath = (TextView) getView().findViewById(R.id.currentPath);

    long id = -1;

    Bundle extras = getArguments();
    if (extras != null) {
        mCurrentList = new Select().from(ResourceList.class)
                .where("Cours = ? AND label = ?", extras.get("coursID"), SupportedModules.CLDOC.name())
                .executeSingle();//from   w  w w .  ja v a 2 s .  co m
        id = extras.getLong("docID", -1);
    }

    if (mCurrentList != null) {
        if (mCurrentList.isExpired() || mCurrentList.resources().size() == 0
                && ((AppActivity) getActivity()).mustUpdate(AppActivity.ONCE_PER_DAY)) {
            ((AppActivity) getActivity()).setProgressIndicator(true);
            ((AppActivity) getActivity()).getService().getResourcesForList(mCurrentList,
                    new AsyncHttpResponseHandler() {
                        @Override
                        public void onFinish() {
                            if (getActivity() != null) {
                                ((AppActivity) getActivity()).setProgressIndicator(false);
                            }
                        }

                        @Override
                        public void onSuccess(final String content) {
                            refreshUI();
                            if (getActivity() != null) {
                                ((AppActivity) getActivity()).updatesNow();
                            }
                        }
                    });
        } else if (mCurrentList.isTimeToUpdate()) {
            ((AppActivity) getActivity()).getService().getUpdates(new AsyncHttpResponseHandler() {
                @Override
                public void onSuccess(final String content) {
                    if (!content.equals("[]")) {
                        refreshUI();
                    }
                    if (getActivity() != null) {
                        ((AppActivity) getActivity()).updatesNow();
                    }
                }
            });
        }

        if (id != -1) {
            mCurrentRoot = ((Document) new Select().from(Document.class).where("Id = ", id).executeSingle())
                    .getRoot();
        } else if (mCurrentRoot == null) {
            mCurrentRoot = Document.getEmptyRoot(mCurrentList);
        }
        refreshUI();
    } else {
        getActivity().finish();
    }
}