当前位置: 首页>>代码示例>>Java>>正文


Java Intent.getSerializableExtra方法代码示例

本文整理汇总了Java中android.content.Intent.getSerializableExtra方法的典型用法代码示例。如果您正苦于以下问题:Java Intent.getSerializableExtra方法的具体用法?Java Intent.getSerializableExtra怎么用?Java Intent.getSerializableExtra使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.Intent的用法示例。


在下文中一共展示了Intent.getSerializableExtra方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onActivityResult

import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK) {
        if (requestCode == PICK_PIC_REQUEST) {
            List<String> photos = (List<String>) data.getSerializableExtra(GalleryActivity.PHOTOS);
            presenter.openCropper(photos.get(0));
        }
        if (requestCode == UCrop.REQUEST_CROP) {
            try {
                String filename = FNAME_PREFIX + System.currentTimeMillis();
                presenter.processPicture(
                        openFileOutput(filename, Context.MODE_PRIVATE), filename, UCrop.getOutput(data));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }
    }
}
 
开发者ID:vshkl,项目名称:PXLSRT,代码行数:19,代码来源:CameraActivity.java

示例2: getMessagesFromIntent

import android.content.Intent; //导入方法依赖的package包/类
/**
 * Parse the messages out of the extra fields from the "android.permission.RECEIVE_SMS" broadcast
 * intent.
 *
 * Note: This code was copied from the Android android.provider.Telephony.Sms.Intents class.
 *
 * @param intent the intent to read from
 * @return an array of SmsMessages for the PDUs
 */
public static SmsMessage[] getMessagesFromIntent(
                                                 Intent intent) {
  Object[] messages = (Object[]) intent.getSerializableExtra("pdus");
  byte[][] pduObjs = new byte[messages.length][];

  for (int i = 0; i < messages.length; i++) {
    pduObjs[i] = (byte[]) messages[i];
  }
  byte[][] pdus = new byte[pduObjs.length][];
  int pduCount = pdus.length;
  SmsMessage[] msgs = new SmsMessage[pduCount];
  for (int i = 0; i < pduCount; i++) {
    pdus[i] = pduObjs[i];
    msgs[i] = SmsMessage.createFromPdu(pdus[i]);
  }
  return msgs;
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:27,代码来源:Texting.java

示例3: initUI

import android.content.Intent; //导入方法依赖的package包/类
public void initUI() {
    super.initUI();
    Intent intent = getIntent();
    UserBean user = (UserBean) intent.getSerializableExtra("User");
    String fromValue = intent.getStringExtra("from");
    this.pointsdraw = (Button) findViewById(R.id.pointsdraw);
    this.pointsconvert = (Button) findViewById(R.id.pointsconvert);
    this.pim_head = (RoundImageView) findViewById(R.id.pim_head);
    this.hPlay = (TextView) findViewById(R.id.iniviteNum);
    this.points_name = (TextView) findViewById(R.id.points_name);
    this.mypoints = (TextView) findViewById(R.id.mypoints);
    this.list = (ListView) findViewById(R.id.poinlist);
    if (user != null) {
        initView(user);
        getUserPointInfo();
    } else if (!TextUtils.isEmpty(fromValue) && "webview".equals(fromValue)) {
        if (PreferencesManager.getInstance().isLogin()) {
            getUserBeanTask();
        } else {
            LetvLoginActivity.launch((Activity) this, 3);
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:24,代码来源:PointsActivtiy.java

示例4: onCreate

import android.content.Intent; //导入方法依赖的package包/类
@Override protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_edit_info);
  StatusBarCompat.compat(this, 0x20000000);
  ButterKnife.bind(this);
  setSupportActionBar(toolbar);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);

  Intent intent = getIntent();
  currentType = intent.getIntExtra("onClickType", CLOSE_TYPE);
  incidentDto = (IncidentDto) intent.getSerializableExtra("IncidentDto");
  if (incidentDto == null) {
    ToastUtils.showShortSafe(R.string.item_event_no_exist);
    finish();
  }
  if (CLAIM_TYPE == currentType) {
    getSupportActionBar().setTitle(R.string.item_yes_alarm);
    btnItemClaim.setText(R.string.item_yes);
  } else {
    getSupportActionBar().setTitle(R.string.item_close_alarm);
    btnItemClaim.setText(R.string.item_close);
  }
  //Serializable serializableExtra = intent.getSerializableExtra("");
}
 
开发者ID:Lingzh0ng,项目名称:ITSM,代码行数:25,代码来源:EditInfoActivity.java

示例5: onCreate

import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_news);

    newsPhoto= (ImageView) findViewById(R.id.news_info_photo);
    newsTitle= (TextView) findViewById(R.id.news_info_title);
    newsDesc= (TextView) findViewById(R.id.news_info_desc);

    Intent intent=getIntent();

    News item= (News) intent.getSerializableExtra("News");
    newsPhoto.setImageResource(item.getPhotoId());
    newsTitle.setText(item.getTitle());
    newsDesc.setText(item.getDesc());
}
 
开发者ID:jaimurugan,项目名称:CardViewSample,代码行数:17,代码来源:NewsActivity.java

示例6: onReceive

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    TimerService.TimerDownloadFinishedContent result = (TimerService.TimerDownloadFinishedContent) intent.getSerializableExtra(TimerService.TimerDownloadFinishedBroadcast);

    _progressBar.setVisibility(View.GONE);
    _searchField.setText("");
    _pullRefreshLayout.setRefreshing(false);

    if (result.Success) {
        _lastUpdateTextView.setText(TimerService.getInstance().GetLastUpdate().toString());
        updateList();
    } else {
        displayErrorSnackBar(Tools.DecompressByteArrayToString(result.Response));
        _noDataFallback.setVisibility(View.VISIBLE);
        _searchField.setVisibility(View.INVISIBLE);
    }
}
 
开发者ID:GuepardoApps,项目名称:LucaHome-AndroidApplication,代码行数:18,代码来源:TimerActivity.java

示例7: onActivityResult

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode != Activity.RESULT_OK) {
        return;
    }

    if (requestCode == REQUEST_DATE) {
        Date date = (Date) data
                .getSerializableExtra(DatePickerFragment.EXTRA_DATE);
        mCrime.setDate(date);
        updateDate();
    }
}
 
开发者ID:rsippl,项目名称:AndroidProgramming3e,代码行数:14,代码来源:CrimeFragment.java

示例8: onReceive

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    ObjectChangeFinishedContent result = (ObjectChangeFinishedContent) intent.getSerializableExtra(WirelessSwitchService.WirelessSwitchUpdateFinishedBundle);
    if (result != null) {
        if (result.Success) {
            navigateBack("Updated Switch!");
        } else {
            displayErrorSnackBar(Tools.DecompressByteArrayToString(result.Response));
            _saveButton.setEnabled(true);
        }
    } else {
        displayErrorSnackBar("Failed to update Switch!");
        _saveButton.setEnabled(true);
    }
}
 
开发者ID:GuepardoApps,项目名称:LucaHome-AndroidApplication,代码行数:16,代码来源:WirelessSwitchEditActivity.java

示例9: onReceive

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    DownloadController.DownloadFinishedBroadcastContent content = (DownloadController.DownloadFinishedBroadcastContent) intent.getSerializableExtra(DownloadController.DownloadFinishedBundle);

    if (content.CurrentDownloadType != DownloadController.DownloadType.MeterDataDelete) {
        return;
    }

    String contentResponse = Tools.DecompressByteArrayToString(DownloadStorageService.getInstance().GetDownloadResult(content.CurrentDownloadType));

    if (contentResponse.contains("Error") || contentResponse.contains("ERROR")
            || contentResponse.contains("Canceled") || contentResponse.contains("CANCELED")
            || content.FinalDownloadState != DownloadController.DownloadState.Success) {
        Logger.getInstance().Error(TAG, contentResponse);
        sendFailedDeleteBroadcast(contentResponse);
        return;
    }

    if (!content.Success) {
        Logger.getInstance().Error(TAG, "Download was not successful!");
        sendFailedDeleteBroadcast(contentResponse);
        return;
    }

    _lastUpdate = new Date();

    _broadcastController.SendSerializableBroadcast(
            MeterDataListDeleteFinishedBroadcast,
            MeterDataListDeleteFinishedBundle,
            new ObjectChangeFinishedContent(true, new byte[]{}));

    LoadData();
}
 
开发者ID:GuepardoApps,项目名称:LucaHome-AndroidApplication,代码行数:34,代码来源:MeterListService.java

示例10: readIntent

import android.content.Intent; //导入方法依赖的package包/类
private void readIntent() {
    Intent intent = getIntent();
    this.curPage = intent.getIntExtra(MyDownloadActivityConfig.PAGE, 1);
    this.aid = intent.getLongExtra("aid", 0);
    this.vid = intent.getLongExtra("vid", -1);
    this.launchFrom = intent.getIntExtra("from", 2);
    this.isVideoNormal = intent.getBooleanExtra("isVideoNormal", true);
    this.album = (AlbumInfo) intent.getSerializableExtra("albumInfo");
    this.currentStream = intent.getIntExtra(TaskAddHttpRequest.stream, 1);
    this.episode = intent.getStringExtra("episode");
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:12,代码来源:DownloadVideoAlbumPageActivity.java

示例11: initData

import android.content.Intent; //导入方法依赖的package包/类
private void initData(){
    Intent intent = getIntent();

    imageList = (ArrayList<String>)intent.getSerializableExtra("image");
    position = intent.getIntExtra("position", 0);
    title = intent.getStringExtra("title");

}
 
开发者ID:pooi,项目名称:Nearby,代码行数:9,代码来源:ShowImageActivity.java

示例12: onActivityResult

import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == 0 && resultCode == 0 && data != null) {
        Course course = (Course) data.getSerializableExtra("course");
        //创建课程表左边视图(节数)
        createLeftView(course);
        //创建课程表视图
        createView(course);
        //存储数据到数据库
        saveData(course);
    }
}
 
开发者ID:izcp,项目名称:Kcb,代码行数:13,代码来源:MainActivity.java

示例13: onReceive

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    _logger.Debug("_updateReceiver onReceive");
    WeatherModel currentWeather = (WeatherModel) intent.getSerializableExtra(OWBundles.EXTRA_WEATHER_MODEL);

    if (currentWeather != null) {
        _logger.Debug("currentWeather is: " + currentWeather.toString());

        String description = currentWeather.GetDescription();
        _logger.Debug("Description: " + description);

        WeatherCondition condition = WeatherCondition.GetByString(description);
        int iconId = condition.GetIcon();

        _logger.Debug("WeatherCondition: " + condition.toString());
        _logger.Debug("IconId: " + String.valueOf(iconId));

        CurrentWeatherModel model = new CurrentWeatherModel(
                condition.toString(),
                currentWeather.GetTemperatureString(),
                currentWeather.GetHumidity(),
                currentWeather.GetPressure(),
                currentWeather.GetLastUpdate().toString(),
                iconId,
                "",
                "",
                "",
                "");
        _logger.Debug("CurrentWeatherModel: " + model.toString());

        _broadcastController.SendSerializableBroadcast(
                Broadcasts.SHOW_CURRENT_WEATHER_MODEL,
                Bundles.CURRENT_WEATHER_MODEL,
                model);
    } else {
        _logger.Warn("Current weather is null!");
    }
}
 
开发者ID:GuepardoApps,项目名称:LucaHome-MediaServer,代码行数:39,代码来源:CurrentWeatherUpdater.java

示例14: onActivityResult

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode != Activity.RESULT_OK) {
        return;
    }

    if (requestCode == REQUEST_DATE) {
        Date date = (Date) data
                .getSerializableExtra(DatePickerFragment.EXTRA_DATE);
        mCrime.setDate(date);
        updateDate();
    } else if (requestCode == REQUEST_CONTACT && data != null) {
        Uri contactUri = data.getData();
        // Specify which fields you want your query to return
        // values for.
        String[] queryFields = new String[]{
                ContactsContract.Contacts.DISPLAY_NAME
        };
        // Perform your query - the contactUri is like a "where"
        // clause here
        Cursor c = getActivity().getContentResolver()
                .query(contactUri, queryFields, null, null, null);
        try {
            // Double-check that you actually got results
            if (c.getCount() == 0) {
                return;
            }
            // Pull out the first column of the first row of data -
            // that is your suspect's name.
            c.moveToFirst();
            String suspect = c.getString(0);
            mCrime.setSuspect(suspect);
            mSuspectButton.setText(suspect);
        } finally {
            c.close();
        }
    }
}
 
开发者ID:rsippl,项目名称:AndroidProgramming3e,代码行数:39,代码来源:CrimeFragment.java

示例15: onActivityResult

import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == Activity.RESULT_OK) {
        switch (requestCode) {
            case Constant.REQUEST_CODE_EDIT_USER_INFO:
                user = (User) data.getSerializableExtra("user");
                nick.setText(user.getNick());
                signature.setText(user.getSignature());
                Glide.with(this).load(user.getAvatar()).diskCacheStrategy(DiskCacheStrategy.ALL).into(icon_1);
                ToastUtils.showShortToast("保存个人信息成功");
                Glide.with(this).load(user.getAvatar()).diskCacheStrategy(DiskCacheStrategy.ALL).into(avatar);
                break;
            case Constant.REQUEST_CODE_WEATHER_INFO:
                LogUtil.e("返回天气数据");
                WeatherInfoBean weatherInfoBean = (WeatherInfoBean) data.getSerializableExtra("WeatherInfo");
                if (weatherInfoBean != null) {
                    mWeatherInfoBean = weatherInfoBean;
                    weatherCity.setText(mWeatherInfoBean.getCity());
                    weatherTemperature.setText(mWeatherInfoBean.getTemperature());
                }
                break;
            case Constant.REQUEST_CODE_SELECT_WALLPAPER:
                updateMenuBg();
                break;
        }
    }
}
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:29,代码来源:MainActivity.java


注:本文中的android.content.Intent.getSerializableExtra方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。