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:tjs.tuneramblr.services.TrackCheckinService.java

/**
 * Performs a checkin for the current track and meta data
 * //w ww .  j a  va 2 s .c om
 * @param intent
 *            the intent sent to this service
 * @return a result indicating success or failure
 */
protected CheckinResult checkin(Intent intent) {
    String addSongMessage = "";
    CheckinResult result = null;
    try {

        // pull content out of the intents
        String userDefString = intent.getStringExtra(TuneramblrConstants.EXTRA_DOING_WHAT_KEY);
        Uri imageUri = intent.getParcelableExtra(TuneramblrConstants.EXTRA_IMG_URI_KEY);
        Location userLocation = intent.getParcelableExtra(TuneramblrConstants.EXTRA_LOCATION_KEY);
        CheckinType checkinType = (CheckinType) intent
                .getSerializableExtra(TuneramblrConstants.EXTRA_TRACK_CHECKIN_TYPE_KEY);
        TrackInfo trackInfo = intent.getParcelableExtra(TuneramblrConstants.EXTRA_TRACK_INFO_KEY);

        // I want to also grab the time
        long currentTime = System.currentTimeMillis();

        // this assumes that the user def input is CSV string
        String[] userDef = userDefString.split(",");

        // build a metadata manager
        MetadataManager metaManager = new MetadataManager();

        // don't even bother with the rest of this stuff if
        // we were unable to retrieve the track information
        if (haveTrackInfo(trackInfo)) {

            // we now know that we have some track information, so why don't
            // we go ahead and pull that
            String artist = trackInfo.getArtist();
            String album = trackInfo.getAlbum();
            String trackName = trackInfo.getTrack();

            // username and password
            UserInfoDS userInfoDs = new UserInfoDS(getApplicationContext());
            UserInfo userInfo = userInfoDs.readUserInfo();
            String username = userInfo.getUsername();
            String password = userInfo.getPassword();

            try {
                // get the current weather
                Weather localWeather = metaManager.getLocalWeather(userLocation);

                // get the image, well, get it if the user actually took a
                // picture. nothing says that you are required to do so, so
                // if they did not take a picture the imageUri will be null,
                // check for that
                String imgStr = null;
                if (imageUri != null) {
                    ImageRequester imgRequester = new BasicImageRequester(getContentResolver(), imageUri);
                    imgStr = imgRequester.retrieveImage();
                }

                // get the add song URI to POST to
                // TODO: HTTP + SSL
                URI addSongUri = TuneramblrUrlHelper.getInstance().getAddSongHttpPostUrl();

                // something could have gone wrong when we created the URI,
                // which would result in a NULL URI. Let's check this.
                if (addSongUri != null) {
                    String queryString = TuneramblrUrlHelper.getInstance().buildAddSongQueryString(userLocation,
                            trackName, artist, album, localWeather, userDef, username, password, imgStr,
                            currentTime, checkinType);
                    String responseString = HttpUtil.getInstance().makePost(addSongUri, queryString);

                    // parse the response and pull the response message
                    JSONObject songResultJson = new JSONObject(responseString);
                    addSongMessage = songResultJson.getString("message");
                }

            } catch (IOException ioe) {
                Log.e(TAG, "Failed to make call to server: " + ioe.getMessage(), ioe);
            } catch (JSONException je) {
                Log.e(TAG, "Failed to make call to server: " + je.getMessage(), je);
            }
        } else {
            Log.e(TAG, "TrackInfo came back null.  Did not attempt to add the track.");
        }
    } catch (IOException e) {
        Log.e(TAG, "IOException occurred");
    } finally {

        // if we got a response back, show the message
        if (addSongMessage != null) {
            Log.d(TAG, "Track has been added.");
            result = new CheckinResult(addSongMessage, true);
        } else {
            Log.d(TAG, "Track has not been added.");
            result = new CheckinResult(CHECKIN_UNSUCCESSFUL_MESSAGE, false);
            // TODO: add the request to the retry queue
        }
    }
    return result;
}

From source file:com.duy.pascal.ui.editor.BaseEditorActivity.java

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    DLog.d(TAG, "onNewIntent() called with: intent = [" + intent + "]");
    if (intent.getSerializableExtra(CompileManager.EXTRA_FILE) != null) {
        File file = (File) intent.getSerializableExtra(CompileManager.EXTRA_FILE);
        if (!file.exists()) {
            Toast.makeText(this, R.string.file_not_found, Toast.LENGTH_SHORT).show();
            return;
        }//  www  . ja  v a2 s. co  m
        addNewPageEditor(file);
        //remove path
        intent.removeExtra(CompileManager.EXTRA_FILE);
    }
}

From source file:org.hopestarter.wallet.ui.send.SweepWalletFragment.java

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

    setRetainInstance(true);/*from w  ww  .  ja  v a 2 s. c o m*/
    setHasOptionsMenu(true);

    backgroundThread = new HandlerThread("backgroundThread", Process.THREAD_PRIORITY_BACKGROUND);
    backgroundThread.start();
    backgroundHandler = new Handler(backgroundThread.getLooper());

    if (savedInstanceState != null) {
        restoreInstanceState(savedInstanceState);
    } else {
        final Intent intent = activity.getIntent();

        if (intent.hasExtra(SweepWalletActivity.INTENT_EXTRA_KEY)) {
            privateKeyToSweep = (VersionedChecksummedBytes) intent
                    .getSerializableExtra(SweepWalletActivity.INTENT_EXTRA_KEY);

            // delay until fragment is resumed
            handler.post(maybeDecodeKeyRunnable);
        }
    }
}

From source file:auribises.com.visitorbook.Activites.AdminEntryActivity.java

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

    ButterKnife.inject(this);

    preferences = getSharedPreferences(Util.PREFS_NAME, MODE_PRIVATE);
    editor = preferences.edit();//from  w  w w. j a  v a2s.  c om

    progressDialog = new ProgressDialog(this);
    progressDialog.setMessage("Please Wait..");
    progressDialog.setCancelable(false);

    adminentry = new Adminentry();

    adapter1 = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item);
    adapter1.add("--Select IDProof--");
    adapter1.add("Aadhar Card");
    adapter1.add("License");
    adapter1.add("PAN Card");
    adapter1.add("Voter Card");

    spIDProof.setAdapter(adapter1);

    spIDProof.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            if (i != 0) {
                adminentry.setIDProof(adapter1.getItem(i));
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {

        }
    });

    adapter2 = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item);
    adapter2.add("--Vehicle Type--");
    adapter2.add("None");
    adapter2.add("Car");
    adapter2.add("Bike");
    adapter2.add("Activa");

    spVehicle.setAdapter(adapter2);

    spVehicle.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            if (i != 0) {
                adminentry.setVehicle(adapter2.getItem(i));
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {

        }
    });

    rbMale.setOnCheckedChangeListener(this);
    rbFemale.setOnCheckedChangeListener(this);

    resolver = getContentResolver();

    requestQueue = Volley.newRequestQueue(this);

    Intent rcv = getIntent();
    updateMode = rcv.hasExtra("keyAdminentry");

    if (updateMode) {
        rcvAdminentry = (Adminentry) rcv.getSerializableExtra("keyAdminentry");
        eTxtName.setText(rcvAdminentry.getName());
        eTxtPhone.setText(rcvAdminentry.getPhone());
        eTxtEmail.setText(rcvAdminentry.getEmail());
        eTxtAddress.setText(rcvAdminentry.getAddress());
        eTxtPurpose.setText(rcvAdminentry.getPurpose());
        eTxtDate.setText(rcvAdminentry.getDate());
        eTxtTime.setText(rcvAdminentry.getTime());
        eTxtAdmin.setText(rcvAdminentry.getAdmin());
        eTxtIDProofNumber.setText(rcvAdminentry.getIDProofnumber());
        eTxtVehicleNumber.setText(rcvAdminentry.getVehiclenumber());

        if (rcvAdminentry.getGender().equals("Male")) {
            rbMale.setChecked(true);
        } else {
            rbFemale.setChecked(true);
        }

        int q = 0;
        for (int i = 0; i < adapter1.getCount(); i++) {
            if (adapter1.getItem(i).equals(rcvAdminentry.getIDProof())) {
                Log.i("TEST2", adapter1.getItem(i) + " - " + rcvAdminentry.getIDProof());
                q = i;
                break;
            }
        }
        spIDProof.setSelection(q);

        int r = 0;
        for (int i = 0; i < adapter2.getCount(); i++) {
            if (adapter2.getItem(i).equals(rcvAdminentry.getVehicle())) {
                Log.i("TEST3", adapter2.getItem(i) + " - " + rcvAdminentry.getVehicle());
                r = i;
                break;
            }
        }
        spVehicle.setSelection(r);

        btnSubmit.setText("Update");
    }
}

From source file:li.klass.fhem.activities.core.FragmentBaseActivity.java

private Optional<FragmentType> getFragmentTypeFromStartupIntent() {
    Optional<FragmentType> toReturn = Optional.absent();

    Intent intent = getIntent();
    if (intent != null) {
        if (intent.hasExtra(FRAGMENT)) {
            toReturn = Optional.of((FragmentType) intent.getSerializableExtra(BundleExtraKeys.FRAGMENT));
        } else if (intent.hasExtra(FRAGMENT_NAME)) {
            String fragmentName = intent.getStringExtra(BundleExtraKeys.FRAGMENT_NAME);
            toReturn = Optional.of(FragmentType.valueOf(fragmentName));
        }//www  . jav a2 s .co m
    }
    return toReturn;
}

From source file:com.alivenet.dmvtaxi.fragment.FragmentArriveDriver.java

public void DataUpdateBackgroundService() {

    final BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(R.mipmap.car);
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction("update_map1");
    deliveryBroadcastReceiver = new BroadcastReceiver() {
        @Override/*from w ww .  j  ava2s.  co  m*/
        public void onReceive(Context context, Intent intent) {
            //TODO  map updations work here
            System.out.println("update run FragmentArrive");

            mDriverdetailsList = (ArrayList<Driverdetails>) intent.getSerializableExtra("backgroundArraylist");
            // System.out.println("mDriverdetailsList info===>>>>"+mDriverdetailsList+mDriverdetailsList.size());
            if (mDriverdetailsList != null) {
                System.out.println("mDriverdetailsList infoarrive===>>>>" + mDriverdetailsList
                        + mDriverdetailsList.size());
                for (int j = 0; j < mDriverdetailsList.size(); j++) {

                    if (mDriverdetailsList.get(j).getDriverdetailslocations() != null
                            && mDriverdetailsList.get(j).getDriverdetailslocations().size() > 0) {

                        String lat = "";
                        String lng = "";

                        for (int i = 0; i < mDriverdetailsList.get(j).getDriverdetailslocations().size(); i++) {
                            if (MyApplication.driverId != null && !MyApplication.driverId.equals("")
                                    && MyApplication.driverId.equals(mDriverdetailsList.get(j).getDriverId())) {
                                System.out.println("ArriveDriver" + MyApplication.driverId);
                                lat = mDriverdetailsList.get(j).getDriverdetailslocations().get(i)
                                        .getLatitude();
                                lng = mDriverdetailsList.get(j).getDriverdetailslocations().get(i)
                                        .getLongitude();

                                validateGET_TIME(latitude, longitude, Double.parseDouble(lat),
                                        Double.parseDouble(lng));
                                if (marker != null) {
                                    System.out.println("ArriveDriver" + "ifunder>>>>>>>>>>>>>>>>>>>>>");
                                    marker.setPosition(
                                            new LatLng(Double.parseDouble(lat), Double.parseDouble(lng)));
                                    angle = (float) finalBearing(previousLocationLatitude,
                                            previousLocationLongitude, Double.parseDouble(lat),
                                            Double.parseDouble(lng));
                                    CameraPosition cameraPosition = new CameraPosition.Builder()
                                            .target(new LatLng(previousLocationLatitude,
                                                    previousLocationLongitude))
                                            .bearing(angle).tilt(90).zoom(15).build();
                                    googleMap.animateCamera(
                                            CameraUpdateFactory.newCameraPosition(cameraPosition));

                                    previousLocationLatitude = Double.parseDouble(lat);
                                    previousLocationLongitude = Double.parseDouble(lng);

                                } else {
                                    System.out.println("ArriveDriver" + "elseunder>>>>>>>>>>>>>>>>>>>>>");
                                    marker = googleMap.addMarker(markerOptions.icon(icon).position(new LatLng(
                                            Double.parseDouble(mDriverdetailsList.get(j)
                                                    .getDriverdetailslocations().get(i).getLatitude()),
                                            Double.parseDouble(mDriverdetailsList.get(j)
                                                    .getDriverdetailslocations().get(i).getLongitude())))
                                            .draggable(true).visible(true));

                                    CameraPosition cameraPosition = new CameraPosition.Builder()
                                            .target(new LatLng(previousLocationLatitude,
                                                    previousLocationLongitude))
                                            .bearing(angle).tilt(90).zoom(15).build();
                                    googleMap.animateCamera(
                                            CameraUpdateFactory.newCameraPosition(cameraPosition));

                                    previousLocationLatitude = Double.parseDouble(mDriverdetailsList.get(j)
                                            .getDriverdetailslocations().get(i).getLatitude());
                                    previousLocationLongitude = Double.parseDouble(mDriverdetailsList.get(j)
                                            .getDriverdetailslocations().get(i).getLongitude());

                                }
                            }

                        }

                    }

                }
            }

        }
    };
    getActivity().registerReceiver(deliveryBroadcastReceiver, intentFilter);

}

From source file:com.readystatesoftware.android.geras.mqtt.GerasMqttService.java

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    String host = intent.getStringExtra(EXTRA_HOST);
    String apiKey = intent.getStringExtra(EXTRA_API_KEY);
    ArrayList<GerasSensorConfig> monitors = intent.getParcelableArrayListExtra(EXTRA_SENSOR_MONITORS);
    for (GerasSensorConfig m : monitors) {
        mSensorMonitorMap.put(m.getSensorType(), m);
    }//from w  ww . j a  v a 2 s .com
    mLocationMonitor = intent.getParcelableExtra(EXTRA_LOCATION_MONTITOR);
    mNotificationTarget = (Class) intent.getSerializableExtra(EXTRA_NOTIFICATION_TARGET_CLASS);
    sIsRunning = true;
    showNotification();
    connect(host, apiKey);
    return Service.START_STICKY;
}

From source file:com.nadmm.airports.wx.MetarFragment.java

protected void showMetar(Intent intent) {
    if (getActivity() == null) {
        // Not ready to do this yet
        return;//from   w w  w. j a  v a2s .c  o m
    }

    Metar metar = (Metar) intent.getSerializableExtra(NoaaService.RESULT);
    if (metar == null) {
        return;
    }

    View detail = findViewById(R.id.wx_detail_layout);
    LinearLayout layout = (LinearLayout) findViewById(R.id.wx_status_layout);
    layout.removeAllViews();
    TextView tv = (TextView) findViewById(R.id.status_msg);
    if (!metar.isValid) {
        tv.setVisibility(View.VISIBLE);
        layout.setVisibility(View.VISIBLE);
        tv.setText("Unable to get METAR for this location");
        addRow(layout, "This could be due to the following reasons:");
        addBulletedRow(layout, "Network connection is not available");
        addBulletedRow(layout, "ADDS does not publish METAR for this station");
        addBulletedRow(layout, "Station is currently out of service");
        addBulletedRow(layout, "Station has not updated the METAR for more than 3 hours");
        detail.setVisibility(View.GONE);
        stopRefreshAnimation();
        setFragmentContentShown(true);
        return;
    } else {
        tv.setText("");
        tv.setVisibility(View.GONE);
        layout.setVisibility(View.GONE);
        detail.setVisibility(View.VISIBLE);
    }

    tv = (TextView) findViewById(R.id.wx_station_info2);
    WxUtils.setFlightCategoryDrawable(tv, metar.flightCategory);

    tv = (TextView) findViewById(R.id.wx_age);
    tv.setText(TimeUtils.formatElapsedTime(metar.observationTime));

    // Raw Text
    tv = (TextView) findViewById(R.id.wx_raw_metar);
    tv.setText(metar.rawText);

    // Winds
    tv = (TextView) findViewById(R.id.wx_wind_label);
    layout = (LinearLayout) findViewById(R.id.wx_wind_layout);
    layout.removeAllViews();
    int visibility = View.GONE;
    if (metar.windSpeedKnots < Integer.MAX_VALUE) {
        showWindInfo(layout, metar);
        visibility = View.VISIBLE;
    }
    tv.setVisibility(visibility);
    layout.setVisibility(visibility);

    // Visibility
    tv = (TextView) findViewById(R.id.wx_vis_label);
    layout = (LinearLayout) findViewById(R.id.wx_vis_layout);
    layout.removeAllViews();
    visibility = View.GONE;
    if (metar.visibilitySM < Float.MAX_VALUE) {
        if (metar.flags.contains(Flags.AutoReport) && metar.visibilitySM == 10) {
            addRow(layout, "10+ statute miles horizontal");
        } else {
            NumberFormat decimal2 = NumberFormat.getNumberInstance();
            decimal2.setMaximumFractionDigits(2);
            decimal2.setMinimumFractionDigits(0);
            addRow(layout,
                    String.format("%s statute miles horizontal", FormatUtils.formatNumber(metar.visibilitySM)));
        }
        if (metar.vertVisibilityFeet < Integer.MAX_VALUE) {
            addRow(layout, String.format("%s vertical", FormatUtils.formatFeetAgl(metar.vertVisibilityFeet)));
        }
        visibility = View.VISIBLE;
    }
    tv.setVisibility(visibility);
    layout.setVisibility(visibility);

    // Weather
    layout = (LinearLayout) findViewById(R.id.wx_weather_layout);
    layout.removeAllViews();
    for (WxSymbol wx : metar.wxList) {
        addWeatherRow(layout, wx, metar.flightCategory);
    }

    // Sky Conditions
    tv = (TextView) findViewById(R.id.wx_sky_cond_label);
    layout = (LinearLayout) findViewById(R.id.wx_sky_cond_layout);
    layout.removeAllViews();
    visibility = View.GONE;
    if (!metar.skyConditions.isEmpty()) {
        for (SkyCondition sky : metar.skyConditions) {
            addSkyConditionRow(layout, sky, metar.flightCategory);
        }
        visibility = View.VISIBLE;
    }
    tv.setVisibility(visibility);
    layout.setVisibility(visibility);

    // Temperature
    tv = (TextView) findViewById(R.id.wx_temp_label);
    layout = (LinearLayout) findViewById(R.id.wx_temp_layout);
    layout.removeAllViews();
    visibility = View.GONE;
    if (metar.tempCelsius < Float.MAX_VALUE && metar.dewpointCelsius < Float.MAX_VALUE) {
        addRow(layout, "Temperature", FormatUtils.formatTemperature(metar.tempCelsius));
        if (metar.dewpointCelsius < Float.MAX_VALUE) {
            addRow(layout, "Dew point", FormatUtils.formatTemperature(metar.dewpointCelsius));
            addRow(layout, "Relative humidity", String.format("%.0f%%", WxUtils.getRelativeHumidity(metar)));

            long denAlt = WxUtils.getDensityAltitude(metar);
            if (denAlt > mElevation) {
                addRow(layout, "Density altitude", FormatUtils.formatFeet(denAlt));
            }
        } else {
            addRow(layout, "Dew point", "n/a");
        }

        if (metar.maxTemp6HrCentigrade < Float.MAX_VALUE) {
            addRow(layout, "6-hour maximum", FormatUtils.formatTemperature(metar.maxTemp6HrCentigrade));
        }
        if (metar.minTemp6HrCentigrade < Float.MAX_VALUE) {
            addRow(layout, "6-hour minimum", FormatUtils.formatTemperature(metar.minTemp6HrCentigrade));
        }
        if (metar.maxTemp24HrCentigrade < Float.MAX_VALUE) {
            addRow(layout, "24-hour maximum", FormatUtils.formatTemperature(metar.maxTemp24HrCentigrade));
        }
        if (metar.minTemp24HrCentigrade < Float.MAX_VALUE) {
            addRow(layout, "24-hour minimum", FormatUtils.formatTemperature(metar.minTemp24HrCentigrade));
        }
        visibility = View.VISIBLE;
    }
    tv.setVisibility(visibility);
    layout.setVisibility(visibility);

    // Pressure
    tv = (TextView) findViewById(R.id.wx_pressure_label);
    layout = (LinearLayout) findViewById(R.id.wx_pressure_layout);
    layout.removeAllViews();
    visibility = View.GONE;
    if (metar.altimeterHg < Float.MAX_VALUE) {
        addRow(layout, "Altimeter", FormatUtils.formatAltimeter(metar.altimeterHg));
        if (metar.seaLevelPressureMb < Float.MAX_VALUE) {
            addRow(layout, "Sea level pressure",
                    String.format("%s mb", FormatUtils.formatNumber(metar.seaLevelPressureMb)));
        }
        long presAlt = WxUtils.getPressureAltitude(metar);
        if (presAlt > mElevation) {
            addRow(layout, "Pressure altitude", FormatUtils.formatFeet(presAlt));
        }
        if (metar.pressureTend3HrMb < Float.MAX_VALUE) {
            addRow(layout, "3-hour tendency", String.format("%+.2f mb", metar.pressureTend3HrMb));
        }
        if (metar.presfr) {
            addRow(layout, "Pressure falling rapidly");
        }
        if (metar.presrr) {
            addRow(layout, "Pressure rising rapidly");
        }
        visibility = View.VISIBLE;
    }
    tv.setVisibility(visibility);
    layout.setVisibility(visibility);

    // Precipitation
    tv = (TextView) findViewById(R.id.wx_precip_label);
    layout = (LinearLayout) findViewById(R.id.wx_precip_layout);
    layout.removeAllViews();
    if (metar.precipInches < Float.MAX_VALUE) {
        addRow(layout, "1-hour precipitation", String.format("%.2f\"", metar.precipInches));
    }
    if (metar.precip3HrInches < Float.MAX_VALUE) {
        addRow(layout, "3-hour precipitation", String.format("%.2f\"", metar.precip3HrInches));
    }
    if (metar.precip6HrInches < Float.MAX_VALUE) {
        addRow(layout, "6-hour precipitation", String.format("%.2f\"", metar.precip6HrInches));
    }
    if (metar.precip24HrInches < Float.MAX_VALUE) {
        addRow(layout, "24-hour precipitation", String.format("%.2f\"", metar.precip24HrInches));
    }
    if (metar.snowInches < Float.MAX_VALUE) {
        addRow(layout, "Snow depth", String.format("%.0f\"", metar.snowInches));
    }
    if (metar.snincr) {
        addRow(layout, "Snow is increasing rapidly");
    }
    visibility = layout.getChildCount() > 0 ? View.VISIBLE : View.GONE;
    tv.setVisibility(visibility);
    layout.setVisibility(visibility);

    // Remarks
    tv = (TextView) findViewById(R.id.wx_remarks_label);
    layout = (LinearLayout) findViewById(R.id.wx_remarks_layout);
    layout.removeAllViews();
    for (Flags flag : metar.flags) {
        addBulletedRow(layout, flag.toString());
    }
    for (String remark : mRemarks) {
        addBulletedRow(layout, remark);
    }
    visibility = layout.getChildCount() > 0 ? View.VISIBLE : View.GONE;
    tv.setVisibility(visibility);
    layout.setVisibility(visibility);

    // Fetch time
    tv = (TextView) findViewById(R.id.wx_fetch_time);
    tv.setText("Fetched on " + TimeUtils.formatDateTime(getActivity(), metar.fetchTime));
    tv.setVisibility(View.VISIBLE);

    stopRefreshAnimation();
    setFragmentContentShown(true);
}

From source file:com.github.play.app.StatusService.java

@Override
public int onStartCommand(final Intent intent, final int flags, final int startId) {
    if (intent != null) {
        String intentKey = intent.getStringExtra(EXTRA_KEY);
        if (!TextUtils.isEmpty(intentKey) && !intentKey.equals(applicationKey)) {
            destroyPusher(pusher);//from   w  ww  .java 2 s  . c  o  m
            createPusher(intentKey);
        }

        boolean updateNotification = intent.hasExtra(EXTRA_NOTIFY);
        if (updateNotification)
            sendNotification = intent.getBooleanExtra(EXTRA_NOTIFY, false);
        Song song = (Song) intent.getSerializableExtra(EXTRA_SONG);
        if (updateNotification && !sendNotification) {
            clearNotification();
        } else if (song != null)
            updateNotification(song);
    }

    return super.onStartCommand(intent, flags, startId);
}

From source file:com.hichinaschool.flashcards.anki.multimediacard.activity.MultimediaCardEditorActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == REQUEST_CODE_EDIT_FIELD) {
        if (resultCode == RESULT_OK) {

            IField field = (IField) data.getSerializableExtra(EditFieldActivity.EXTRA_RESULT_FIELD);
            int index = data.getIntExtra(EditFieldActivity.EXTRA_RESULT_FIELD_INDEX, -1);

            // Failed editing activity
            if (index == -1) {
                return;
            }//from  w w  w .java2 s.c om

            mNote.setField(index, field);
            createEditorUI(mNote);
        }

        super.onActivityResult(requestCode, resultCode, data);
    }
}