Example usage for android.content Intent getSerializableExtra

List of usage examples for android.content Intent getSerializableExtra

Introduction

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

Prototype

public Serializable getSerializableExtra(String name) 

Source Link

Document

Retrieve extended data from the intent.

Usage

From source file:com.androidquery.simplefeed.activity.PostActivity.java

@Override
protected void init(Bundle state) {

    Intent intent = getIntent();

    String message = "";

    photo = (File) intent.getSerializableExtra("photo");
    message = intent.getStringExtra("message");

    if (state != null) {
        if (photo == null) {
            photo = (File) state.getSerializable("photo");
        }//from w  ww  .j  av a  2s.  c o m
        if (message == null) {
            message = state.getString("message");
        }
        location = state.getParcelable("location");
        place = (Place) state.getSerializable("place");
        tags = (List<Entity>) state.getSerializable("tags");
    }

    entity = (Entity) intent.getSerializableExtra("entity");
    item = (FeedItem) intent.getSerializableExtra("item");

    initView(message);

    albumCheck(0);
}

From source file:com.brq.wallet.activity.modern.AddressBookFragment.java

@Override
public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) {
    if (requestCode != SCAN_RESULT_CODE) {
        super.onActivityResult(requestCode, resultCode, intent);
    }//ww w  .j  av a2 s . c om
    if (resultCode != Activity.RESULT_OK) {
        if (intent == null) {
            return; // user pressed back
        }
        String error = intent.getStringExtra(StringHandlerActivity.RESULT_ERROR);
        if (error != null) {
            Toast.makeText(this.getActivity(), error, Toast.LENGTH_LONG).show();
        }
        return;
    }
    StringHandlerActivity.ResultType type = (StringHandlerActivity.ResultType) intent
            .getSerializableExtra(StringHandlerActivity.RESULT_TYPE_KEY);
    if (type == StringHandlerActivity.ResultType.PRIVATE_KEY) {
        Utils.showSimpleMessageDialog(getActivity(), R.string.addressbook_cannot_add_private_key);
        return;
    }
    Preconditions.checkState(type == StringHandlerActivity.ResultType.ADDRESS);
    Address address = StringHandlerActivity.getAddress(intent);
    addFromAddress(address);
}

From source file:org.huxizhijian.hhcomicviewer.ui.entry.ComicDetailsActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    mComic = (Comic) data.getSerializableExtra("comic");
    mComic.setLastReadTime(System.currentTimeMillis());
    if (mVolAdapter != null) {
        mVolAdapter.setReadChapter(mComic.getReadChapter());
    }//  ww w .j av  a 2s.  c  o  m
}

From source file:de.grobox.liberario.fragments.DirectionsFragment.java

private void processIntent() {
    final Intent intent = getActivity().getIntent();
    if (intent != null) {
        final String action = intent.getAction();
        if (action != null && action.equals(TAG)) {
            WrapLocation from, via, to;/*  w ww  .j  a v  a 2s .  com*/
            boolean search;
            Date date;
            String eSpecial = (String) intent.getSerializableExtra("special");
            if (eSpecial != null && eSpecial.equals(TASK_BRING_ME_HOME)) {
                from = new WrapLocation(WrapLocation.WrapType.GPS);
                to = new WrapLocation(WrapLocation.WrapType.HOME);
                search = true;
            } else {
                from = (WrapLocation) intent.getSerializableExtra("from");
                to = (WrapLocation) intent.getSerializableExtra("to");
                search = intent.getBooleanExtra("search", false);
            }
            via = (WrapLocation) intent.getSerializableExtra("via");
            date = (Date) intent.getSerializableExtra("date");

            if (search)
                searchFromTo(from, via, to, date);
            else
                presetFromTo(from, via, to, date);
        }

        // remove the intent (and clear its action) since it was already processed
        // and should not be processed again
        intent.setAction(null);
        getActivity().setIntent(null);
    }
}

From source file:org.csploit.android.services.UpdateService.java

@Override
protected void onHandleIntent(Intent intent) {
    mCurrentTask = (Update) intent.getSerializableExtra(UPDATE);
    boolean exitForError = true;

    if (mCurrentTask == null) {
        Logger.error("received null update");
        return;/*  www  .j  a v a  2  s .c  o  m*/
    }

    mRunning = true;

    try {
        setupNotification();

        mCurrentTask.errorOccurred = true;
        if (!haveLocalFile())
            downloadFile();

        if (mCurrentTask instanceof CoreUpdate)
            System.shutdownCoreDaemon();

        extract();

        if (mCurrentTask instanceof MsfUpdate)
            installGems();

        deleteTemporaryFiles();
        createVersionFile();

        mCurrentTask.errorOccurred = exitForError = false;

        sendDone();
    } catch (SecurityException e) {
        sendError(R.string.bad_permissions);
        Logger.warning(e.getClass().getName() + ": " + e.getMessage());
    } catch (KeyException e) {
        sendError(R.string.checksum_failed);
        Logger.warning(e.getClass().getName() + ": " + e.getMessage());
    } catch (CancellationException e) {
        sendError(R.string.update_cancelled);
        Logger.warning(e.getClass().getName() + ": " + e.getMessage());
    } catch (NoSuchAlgorithmException | RuntimeException | ChildManager.ChildDiedException
            | ChildManager.ChildNotStartedException | InterruptedException | IOException e) {
        sendError(R.string.error_occured);
        System.errorLogging(e);
    } finally {
        if (exitForError) {
            if (mCurrentTask instanceof MsfUpdate)
                clearGemsCache();
            if (!(mCurrentTask instanceof CoreUpdate))
                wipe();
        }
        stopSelf();
        mRunning = false;
    }
}

From source file:com.androidquery.simplefeed.activity.PostActivity.java

private void handleCheckin(Intent data) {

    Location loc = (Location) data.getParcelableExtra("location");
    Place place = (Place) data.getSerializableExtra("place");

    AQUtility.debug(loc, item);/* w ww .  j av  a  2 s  . co  m*/

    if (loc != null && place != null) {

        clear();

        this.location = loc;
        this.place = place;

        attachPlace(place);

        refreshButtons();
    }

}

From source file:net.reichholf.dreamdroid.activities.TimerEditActivity.java

@SuppressWarnings("unchecked")
@Override//  w w  w  . j a v  a  2 s. co m
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == PICK_SERVICE_REQUEST) {
        if (resultCode == RESULT_OK) {
            ExtendedHashMap map = new ExtendedHashMap();
            map.putAll((HashMap<String, Object>) data.getSerializableExtra(sData));

            mTimer.put(Timer.SERVICE_NAME, map.getString(Service.NAME));
            mTimer.put(Timer.REFERENCE, map.getString(Service.REFERENCE));
            mService.setText(mTimer.getString(Timer.SERVICE_NAME));
        }
    }
}

From source file:fr.eyal.lib.data.service.DataLibService.java

@SuppressWarnings("unchecked")
@Override//  ww  w .  j  av a2  s.  c  om
protected void onHandleIntent(final Intent intent) {
    final int processorType = intent.getIntExtra(INTENT_EXTRA_PROCESSOR_TYPE, -1);

    Out.d(TAG, "onHandleIntent");

    //      String userAgent = intent.getStringExtra(INTENT_EXTRA_USER_AGENT);

    final DataLibRequest request = new DataLibRequest();
    DataLibWebConfig.applyToRequest(request, DataLibWebConfig.getInstance()); //we apply a default configuration for the request

    //we get the action data
    request.url = intent.getStringExtra(INTENT_EXTRA_URL);
    request.params = intent.getParcelableExtra(INTENT_EXTRA_PARAMS);
    request.parseType = intent.getIntExtra(INTENT_EXTRA_PARSE_TYPE, DataLibRequest.PARSE_TYPE_SAX_XML);

    //we eventually add the complex options
    Object complexOptions = intent.getSerializableExtra(INTENT_EXTRA_COMPLEX_OPTIONS);
    if (complexOptions instanceof ComplexOptions)
        request.complexOptions = (ComplexOptions) complexOptions;

    request.context = getApplicationContext();
    //we get the options to apply
    int option = intent.getIntExtra(INTENT_EXTRA_REQUEST_OPTION, DataLibRequest.OPTION_NO_OPTION);
    DataLibWebConfig.applyToRequest(request, option, true);

    //we add the intent
    request.intent = intent;

    try {

        if (processorType == COOKIES_FLUSH)
            this.flushCookies();

        else {
            //we launch the processor on a daughter class
            launchProcessor(processorType, request);
        }

    } catch (final Exception e) {
        Out.e(TAG, "Erreur", e);
        final BusinessResponse response = new BusinessResponse();
        response.status = BusinessResponse.STATUS_ERROR;
        response.statusMessage = Log.getStackTraceString(e);
        sendResult(request, response, response.status);
    }

}

From source file:com.mycelium.wallet.activity.modern.RecordsFragment.java

@Override
public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) {
    // after adding a key, remove add key button eventually if limit is hit
    ActivityCompat.invalidateOptionsMenu(getActivity());
    if (requestCode == ADD_RECORD_RESULT_CODE && resultCode == Activity.RESULT_OK) {
        Record record = (Record) intent.getSerializableExtra(AddRecordActivity.RESULT_KEY);
        addRecord(record);// w  w w  .  j av  a 2  s . c  o  m
    } else {
        super.onActivityResult(requestCode, resultCode, intent);
    }
}

From source file:com.retroteam.studio.retrostudio.EditorLandscape.java

/**
 * How to handle a result when we come back from the measure.
 * @param requestCode/*from   w  w  w . j  a v  a 2  s  .  co m*/
 * @param resultCode
 * @param data
 */

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // Check which request we're responding to
    if (requestCode == 123) {
        // Make sure the request was successful
        if (resultCode == RESULT_OK) {
            //Uri thedata = data.getData();
            theproject = (Project) data.getSerializableExtra("Project");
            //redrawMe(theproject);
            updateMe(data.getBooleanExtra("HasNotes", false), data.getIntExtra("trackNum", 0),
                    data.getIntExtra("measureNum", 0), data.getIntExtra("guiSNAP", 0),
                    (ArrayList<int[]>) data.getSerializableExtra("filledNotes"));
        }
    }
}