本文整理汇总了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();
}
}
}
}
示例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;
}
示例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);
}
}
}
示例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("");
}
示例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());
}
示例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);
}
}
示例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();
}
}
示例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);
}
}
示例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();
}
示例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");
}
示例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");
}
示例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);
}
}
示例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!");
}
}
示例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();
}
}
}
示例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;
}
}
}