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:io.v.debug.SyncbaseAndroidService.java

private BindResult startServer(final Intent intent) throws SyncbaseServer.StartException {
    final File storageRoot = new File(getFilesDir(), "syncbase");

    mOptions = (Options) intent.getSerializableExtra(EXTRA_OPTIONS);
    if (mOptions == null) {
        mOptions = new Options();
    }//from   ww  w .  jav  a 2  s .c  o m

    if (mOptions.cleanStart) {
        log.info("Clearing Syncbase data per intent");
        try {
            FileUtils.deleteDirectory(storageRoot);
        } catch (final IOException e) {
            log.error("Could not clear Syncbase data", e);
        }
    }

    VContext serverContext = mVContext;
    if (mOptions.proxy != null) {
        try {
            serverContext = V.withListenSpec(mVContext, V.getListenSpec(mVContext).withProxy(mOptions.proxy));
        } catch (final VException e) {
            log.warn("Unable to set up Vanadium proxy for Syncbase", e);
        }
    }

    storageRoot.mkdirs();

    log.info("Starting Syncbase");
    final VContext sbCtx = SyncbaseServer.withNewServer(serverContext,
            new SyncbaseServer.Params().withPermissions(BlessingsUtils.OPEN_DATA_PERMS)
                    .withStorageRootDir(storageRoot.getAbsolutePath()).withName(mOptions.name)); // name is ignored if null
    final Server server = V.getServer(sbCtx);
    return new BindResult(server, "/" + server.getStatus().getEndpoints()[0]);
}

From source file:com.squareup.leakcanary.internal.HeapAnalyzerService.java

@Override
protected void onHandleIntentInForeground(@Nullable Intent intent) {
    if (intent == null) {
        CanaryLog.d("HeapAnalyzerService received a null intent, ignoring.");
        return;/*from   www .j  av  a  2s .c o  m*/
    }
    String listenerClassName = intent.getStringExtra(LISTENER_CLASS_EXTRA);
    HeapDump heapDump = (HeapDump) intent.getSerializableExtra(HEAPDUMP_EXTRA);

    HeapAnalyzer heapAnalyzer = new HeapAnalyzer(heapDump.excludedRefs, this,
            heapDump.reachabilityInspectorClasses);

    AnalysisResult result = heapAnalyzer.checkForLeak(heapDump.heapDumpFile, heapDump.referenceKey,
            heapDump.computeRetainedHeapSize);
    AbstractAnalysisResultService.sendResultToListener(this, listenerClassName, heapDump, result);
}

From source file:com.stfalcon.hromadskyipatrol.services.UploadService.java

private void handleUploadVideoByStorage(Intent intent) {
    if (intent.hasExtra(Extras.ID) && intent.hasExtra(Extras.URL_VIDEO) && intent.hasExtra(Extras.DATE)) {
        Date date = (Date) intent.getSerializableExtra(Extras.DATE);
        String urlVideo = intent.getStringExtra(Extras.URL_VIDEO);
        String id = intent.getStringExtra(Extras.ID);
        uploadVideo(urlVideo, id, date);
    }//from  w w  w  . j a  v  a  2  s. c  o m
}

From source file:com.brq.wallet.activity.ScanActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = getIntent();
    _stringHandleConfig = Preconditions//  w w  w  .j av  a  2s.  c  o m
            .checkNotNull((StringHandleConfig) intent.getSerializableExtra("request"));
    // Did we already launch the scanner?
    if (savedInstanceState != null) {
        _hasLaunchedScanner = savedInstanceState.getBoolean("hasLaunchedScanner", false);
    }
    // Make sure that we make the screen rotate right after scanning
    if (_hasLaunchedScanner) {
        // the scanner has been launched earlier. This means that we have
        // stored our previous orientation and that we want to try and restore it
        Preconditions.checkNotNull(savedInstanceState);
        _preferredOrientation = savedInstanceState.getInt("lastOrientation", -1);
        if (getScreenOrientation() != _preferredOrientation) {
            //noinspection ResourceType
            setRequestedOrientation(_preferredOrientation);
        }
    } else {
        // The scanner has not been launched yet. Get our current orientation
        // so we can restore it after scanning
        _preferredOrientation = getScreenOrientation();
    }
}

From source file:com.barion.example.app2app.libraryintegration.fragments.ShopFragment.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == Barion.REQUEST_CODE) {
        if (resultCode == Activity.RESULT_OK) {
            BarionGetPaymentStateResponse response = (BarionGetPaymentStateResponse) data
                    .getSerializableExtra(Barion.BARION_PAYMENT_STATE_RESPONSE);
            if (response != null && getActivity() != null) {
                Intent intent = new Intent(getActivity(), PaymentResultActivity.class);
                intent.putExtra(Globals.KEY_PAYMENTSTATE, response);
                startActivity(intent);// ww  w .j a  v  a2  s  . c o m
                getActivity().finish();
            }
        } else if (resultCode == Activity.RESULT_CANCELED) {
            if (data.hasExtra(Barion.ERROR)) {
                ArrayList<BarionError> errors = (ArrayList<BarionError>) data
                        .getSerializableExtra(Barion.ERROR);
                processBarionErrors(errors);
            } else if (data.hasExtra(Barion.BARION_PAYMENT_STATE_RESPONSE)) {
                BarionGetPaymentStateResponse response = (BarionGetPaymentStateResponse) data
                        .getSerializableExtra(Barion.BARION_PAYMENT_STATE_RESPONSE);
                if (response != null) {
                    Log.d(TAG, "Response: " + response.getPaymentState().getStatus());
                }
            }
        }
    }
}

From source file:ru.yandex.subtitles.service.messaging.CreateConversationBroadcastReceiver.java

@Override
public void onReceive(final Context context, final Intent intent) {
    final String action = (intent != null ? intent.getAction() : null);
    if (ACTION_CONVERSATION_CREATED.equals(action)) {
        final long threadId = intent.getLongExtra(EXTRA_CONVERSATION, -1);
        final Long messageId = (Long) intent.getSerializableExtra(EXTRA_MESSAGE);
        final Long memberId = (Long) intent.getSerializableExtra(EXTRA_MEMBER);
        mOnCreateConversationListener.onConversationCreated(threadId, messageId, memberId);

    } else if (ACTION_CONVERSATION_ERROR.equals(action)) {
        final int kind = intent.getIntExtra(EXTRA_KIND, ConversationError.KIND_UNKNOWN);
        mOnCreateConversationListener.onConversationCreateError(kind);

    }//from  ww w . jav a2s  .  c o m
}

From source file:com.indragie.cmput301as1.ExpenseClaimListFragment.java

/**
 * Changes the sorting mode based on a comparator chosen by {@link ExpenseClaimSortActivity}
 * @param data The intent to get the comparator from.
 */// www  . j a va 2  s.co  m
@SuppressWarnings("unchecked")
private void onSortExpenseResult(Intent data) {
    Comparator<ExpenseClaim> comparator = (Comparator<ExpenseClaim>) data
            .getSerializableExtra(ExpenseClaimSortActivity.EXPENSE_CLAIM_SORT);
    controller.sort(comparator);
}

From source file:org.ambient.control.processes.ProcessCardActivity.java

@Override
public void onActivityResult(int request, int response, Intent intent) {

    // handle config Edit
    if (request == EditConfigActivity.REQUEST_EDIT_ROOM_ITEM && response == Activity.RESULT_OK) {
        ProcessCardFragment fragment = (ProcessCardFragment) getSupportFragmentManager()
                .findFragmentByTag(FRAGMENT_TAG);
        Object result = intent.getSerializableExtra(EditConfigActivity.EXTRA_RESULT_VALUE);
        String roomName = intent.getStringExtra(EditConfigActivity.EXTRA_ROOM);
        fragment.onIntegrateConfiguration(roomName, result);
    }/*from w w  w.ja v  a  2 s.  c om*/
}

From source file:eu.trentorise.smartcampus.eb.fragments.ExperiencesListFragment.java

@Override
public void onActivityResult(int reqCode, int resCode, Intent data) {
    if (REQUEST_CODE_PAGER == reqCode && Activity.RESULT_OK == resCode) {
        @SuppressWarnings("unchecked")
        ArrayList<Experience> list = (ArrayList<Experience>) data
                .getSerializableExtra(ExperiencePager.ARG_COLLECTION);
        if (list != null) {
            experiencesList.clear();//from ww w  .ja va  2  s.com
            experiencesList.addAll(list);
            ((ExperiencesListAdapter) getListAdapter()).notifyDataSetChanged();
        }
    }
    super.onActivityResult(reqCode, resCode, data);
}

From source file:com.androidhive.openhourgoogle.MarkerActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.marker_activity);

    // Getting intent data
    Intent i = getIntent();
    nearPlaces = (PlacesList) i.getSerializableExtra("near_places");
    user_search = i.getStringExtra("user_search");
    user_near = i.getStringExtra("user_near");

    // List of LatLng
    latLngPlaceMap = new HashMap<LatLng, Place>();

    // loop through all the places, add each place to hashmap.
    if (nearPlaces != null && nearPlaces.results != null
            && nearPlaces.status.equals(getString(R.string.status_ok))) {
        double latitude;
        double longitude;
        LatLng latlng;/* ww w.ja  v a 2s  .  co  m*/
        for (Place place : nearPlaces.results) {
            latitude = place.geometry.location.lat;
            longitude = place.geometry.location.lng;

            // Geopoint to place on map
            latlng = new LatLng(latitude, longitude);

            // Add to hashmap
            latLngPlaceMap.put(latlng, place);
        }
    }
    setUpMapIfNeeded();
}