本文整理了Java中android.arch.lifecycle.MutableLiveData.setValue()
方法的一些代码示例,展示了MutableLiveData.setValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MutableLiveData.setValue()
方法的具体详情如下:
包路径:android.arch.lifecycle.MutableLiveData
类名称:MutableLiveData
方法名:setValue
暂无
代码示例来源:origin: hidroh/materialistic
public void setLiveValue(Uri uri) {
mLiveData.setValue(uri);
// clear notification Uri after notifying all active observers
mLiveData.setValue(null);
}
代码示例来源:origin: k9mail/k-9
@MainThread
public void setValue(@Nullable T t) {
pending.set(true);
super.setValue(t);
}
代码示例来源:origin: hidroh/materialistic
void setItems(Item[] items) {
mItems.setValue(Pair.create(mItems.getValue() != null ? mItems.getValue().second : null, items));
}
}
代码示例来源:origin: ittianyu/MVVM
@Override
protected void onPostExecute(Long rowId) {
data.setValue(rowId);
}
}.execute();
代码示例来源:origin: retomeier/Wrox-ProfessionalAndroid-4E
@Override
protected void onPostExecute(List<String> _data) {
// Update the Live Data data value.
data.setValue(_data);
}
}.execute();
代码示例来源:origin: ahmadaghazadeh/CodeEditor
public CodeModel(String code, String lang) {
this.code.setValue(code);
this.lang.setValue(lang);
}
}
代码示例来源:origin: jenly1314/WanAndroid
@Override
public void onError(Call<BaseResult<DataBean<List<ArticleBean>>>> call, Throwable t) {
liveData.setValue(Resource.error(t));
}
});
代码示例来源:origin: jenly1314/WanAndroid
@Override
public void onError(Call<BaseResult<List<TreeBean>>> call, Throwable t) {
liveData.setValue(Resource.error(t));
}
});
代码示例来源:origin: jenly1314/WanAndroid
@Override
public void onError(Call<BaseResult<List<TreeBean>>> call, Throwable t) {
liveData.setValue(Resource.error(t));
}
});
代码示例来源:origin: jenly1314/WanAndroid
@Override
public void onError(Call<BaseResult<DataBean<List<ArticleBean>>>> call, Throwable t) {
liveData.setValue(Resource.error(t));
}
});
代码示例来源:origin: Piwigo/Piwigo-Android
@Override public void onError(Throwable e) {
Log.e(TAG, e.getMessage());
progressCircle.hide();
loginError.setValue(e);
}
代码示例来源:origin: Piwigo/Piwigo-Android
public void update(List<T> items) {
this.items.setValue(items);
/* TODO: it doesn't seem to make too much sense to have a MutuableLiveData for items
* instead maybe it would be better to have List<T> and use in this update method a DiffUtil to update
* only what was really changed... */
notifyDataSetChanged();
}
代码示例来源:origin: kioko/android-liveData-viewModel
public void setSearchQuery(@NonNull String originalInput) {
String input = originalInput.toLowerCase(Locale.getDefault()).trim();
if (Objects.equals(input, query.getValue())) {
return;
}
query.setValue(input);
}
代码示例来源:origin: ittianyu/MVVM
@Override
public void onResponse(Call<User> call, Response<User> response) {
User user = response.body();
if (null == user) {
data.setValue(Lcee.<User>empty());
return;
}
data.setValue(Lcee.content(user));
// update cache
LocalUserDataSource.getInstance().addUser(user);
}
代码示例来源:origin: ittianyu/MVVM
@Override
public void onResponse(Call<User> call, Response<User> response) {
User user = response.body();
if (null == user) {
data.setValue(Lcee.<User>empty());
return;
}
data.setValue(Lcee.content(user));
// update cache
LocalUserDataSource.getInstance().addUser(user);
}
代码示例来源:origin: TrustWallet/trust-wallet-android-source
private void onDefaultWallet(Wallet wallet) {
defaultWallet.setValue(wallet);
getBalance();
fetchTransactions();
}
代码示例来源:origin: TrustWallet/trust-wallet-android-source
private void onDefaultWallet(Wallet wallet) {
defaultWallet.setValue(wallet);
if (gasSettings.getValue() == null) {
onGasSettings(fetchGasSettingsInteract.fetch(confirmationForTokenTransfer));
}
}
代码示例来源:origin: kioko/android-liveData-viewModel
@VisibleForTesting
public void setMovieId(int movieId) {
if (Objects.equals(movieId, this.movieId.getValue())) {
return;
}
this.movieId.setValue(movieId);
}
代码示例来源:origin: kioko/android-liveData-viewModel
@VisibleForTesting
public void setPalette(Palette palette) {
if (Objects.equals(palette, mPalette.getValue())) {
return;
}
mPalette.setValue(palette);
}
代码示例来源:origin: kioko/android-liveData-viewModel
public static <T> LiveData<ApiResponse<T>> createCall(Response<T> response) {
MutableLiveData<ApiResponse<T>> data = new MutableLiveData<>();
data.setValue(new ApiResponse<>(response));
return data;
}
}
内容来源于网络,如有侵权,请联系作者删除!