本文整理汇总了Java中android.text.TextUtils.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java TextUtils.isEmpty方法的具体用法?Java TextUtils.isEmpty怎么用?Java TextUtils.isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.text.TextUtils
的用法示例。
在下文中一共展示了TextUtils.isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseMediaType
import android.text.TextUtils; //导入方法依赖的package包/类
private void parseMediaType() {
if (!TextUtils.isEmpty(this.mShareContent) && this.mShareMedia == null) {
this.mShareType = "text";
} else if (this.mShareMedia != null && (this.mShareMedia instanceof UMEmoji)) {
this.mShareType = TYPE_EMOJI;
} else if (TextUtils.isEmpty(this.mShareContent) && this.mShareMedia != null && (this
.mShareMedia instanceof UMImage)) {
this.mShareType = "image";
} else if (this.mShareMedia != null && (this.mShareMedia instanceof UMusic)) {
this.mShareType = TYPE_MUSIC;
} else if (this.mShareMedia != null && (this.mShareMedia instanceof UMVideo)) {
this.mShareType = TYPE_VIDEO;
} else if (!TextUtils.isEmpty(this.mShareContent) && this.mShareMedia != null && (this
.mShareMedia instanceof UMImage)) {
this.mShareType = TYPE_TEXT_IMAGE;
}
}
示例2: queryFavorites
import android.text.TextUtils; //导入方法依赖的package包/类
public List<Track> queryFavorites(String id){
if(!TextUtils.isEmpty(id)){
Cursor cursor=provider.query(Users.buildFavoritesUri(id),null,null,null,null);
if(cursor!=null){
List<Track> tracks=new ArrayList<>(cursor.getCount());
while(cursor.moveToNext()){
Track track=DatabaseUtils.toTrack(cursor);
tracks.add(track);
}
if(!cursor.isClosed()) cursor.close();
return tracks;
}
return null;
}
throw new IllegalArgumentException("Id is null");
}
示例3: validateForm
import android.text.TextUtils; //导入方法依赖的package包/类
private boolean validateForm() {
boolean valid = true;
String email = emailEditText.getText().toString();
if (TextUtils.isEmpty(email)) {
emailEditText.setError("Required.");
valid = false;
} else {
emailEditText.setError(null);
}
String password = passwordEditText.getText().toString();
if (TextUtils.isEmpty(password)) {
passwordEditText.setError("Required.");
valid = false;
} else {
passwordEditText.setError(null);
}
return valid;
}
示例4: convert
import android.text.TextUtils; //导入方法依赖的package包/类
public static CSSPositionType convert(String s) {
CSSPositionType position = CSSPositionType.RELATIVE;
if (TextUtils.isEmpty(s) || s.equals("relative") || s.equals("sticky")) {
position = CSSPositionType.RELATIVE;
} else if (s.equals("absolute") || s.equals("fixed")) {
position = CSSPositionType.ABSOLUTE;
}
return position;
}
示例5: concatenateWhere
import android.text.TextUtils; //导入方法依赖的package包/类
public static String concatenateWhere(String a, String b) {
if (TextUtils.isEmpty(a)) {
return b;
}
if (TextUtils.isEmpty(b)) {
return a;
}
return "(" + a + ") AND (" + b + ")";
}
示例6: updatePostSettings
import android.text.TextUtils; //导入方法依赖的package包/类
private void updatePostSettings() {
String imageUrl = mPost.getFeatureImage();
if (!TextUtils.isEmpty(imageUrl)) {
mPostImageLayoutManager.setViewState(PostImageLayoutManager.ViewState.PROGRESS_BAR);
String blogUrl = AccountManager.getActiveBlogUrl();
imageUrl = NetworkUtils.makeAbsoluteUrl(blogUrl, imageUrl);
getPicasso()
.load(imageUrl)
.fit().centerCrop()
.into(mPostImageLayoutManager.getImageView(), new Callback() {
@Override
public void onSuccess() {
mPostImageLayoutManager.setViewState(PostImageLayoutManager.ViewState.IMAGE);
}
@Override
public void onError() {
Toast.makeText(PostViewActivity.this, R.string.post_image_load_error,
Toast.LENGTH_SHORT).show();
mPostImageLayoutManager.setViewState(PostImageLayoutManager.ViewState.PLACEHOLDER);
}
});
} else {
mPostImageLayoutManager.setViewState(PostImageLayoutManager.ViewState.PLACEHOLDER);
}
List<String> tagStrs = new ArrayList<>();
for (Tag tag : mPost.getTags()) {
tagStrs.add(tag.getName());
}
mPostTagsEditText.setTokens(tagStrs);
mPostExcerptEditText.setText(mPost.getCustomExcerpt());
mPostFeatureCheckBox.setChecked(mPost.isFeatured());
mPostPageCheckBox.setChecked(mPost.isPage());
}
示例7: addToDownloadQueue
import android.text.TextUtils; //导入方法依赖的package包/类
@Subscribe(threadMode = ThreadMode.MAIN)
public synchronized void addToDownloadQueue(DownloadQueue queue) {
if (!TextUtils.isEmpty(queue.bookId)) {
boolean exists = false;
// 判断当前书籍缓存任务是否存在
for (int i = 0; i < downloadQueues.size(); i++) {
if (downloadQueues.get(i).bookId.equals(queue.bookId)) {
LogUtils.e("addToDownloadQueue:exists");
exists = true;
break;
}
}
if (exists) {
post(new DownloadMessage(queue.bookId, "当前缓存任务已存在", false));
return;
}
// 添加到下载队列
downloadQueues.add(queue);
LogUtils.e("addToDownloadQueue:" + queue.bookId);
post(new DownloadMessage(queue.bookId, "成功加入缓存队列", false));
}
// 从队列顺序取出第一条下载
if (downloadQueues.size() > 0 && !isBusy) {
isBusy = true;
downloadBook(downloadQueues.get(0));
}
}
示例8: recordClientPackageName
import android.text.TextUtils; //导入方法依赖的package包/类
private void recordClientPackageName() {
String clientName = CustomTabsConnection.getInstance(getApplication())
.getClientPackageNameForSession(mSession);
if (TextUtils.isEmpty(clientName)) clientName = mIntentDataProvider.getClientPackageName();
final String packageName = clientName;
if (TextUtils.isEmpty(packageName) || packageName.contains(getPackageName())) return;
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
RapporServiceBridge.sampleString(
"CustomTabs.ServiceClient.PackageName", packageName);
}
});
}
示例9: update
import android.text.TextUtils; //导入方法依赖的package包/类
public void update() {
final Context context = getActivity();
if (context == null) return;
if (getPreferenceScreen() != null) getPreferenceScreen().removeAll();
ChromeSigninController signInController = ChromeSigninController.get(context);
if (!signInController.isSignedIn()) {
// The AccountManagementFragment can only be shown when the user is signed in. If the
// user is signed out, exit the fragment.
getActivity().finish();
return;
}
addPreferencesFromResource(R.xml.account_management_preferences);
String signedInAccountName =
ChromeSigninController.get(getActivity()).getSignedInAccountName();
String fullName = getCachedUserName(signedInAccountName);
if (TextUtils.isEmpty(fullName)) {
fullName = ProfileDownloader.getCachedFullName(Profile.getLastUsedProfile());
}
if (TextUtils.isEmpty(fullName)) fullName = signedInAccountName;
getActivity().setTitle(fullName);
configureSignOutSwitch();
configureAddAccountPreference();
configureChildAccountPreferences();
configureSyncSettings();
configureGoogleActivityControls();
updateAccountsList();
}
示例10: onSearchStateChanged
import android.text.TextUtils; //导入方法依赖的package包/类
@Override
public void onSearchStateChanged(boolean b) {
SearchActivity activity = weakActivity.get();
if (null == activity) return;
if (TextUtils.isEmpty(activity.mSearchBar.getText().trim())) {
activity.finish();
}
}
示例11: handleDecodeInternally
import android.text.TextUtils; //导入方法依赖的package包/类
private void handleDecodeInternally(String code) {
if (!TextUtils.isEmpty(code)) {
Uri uri = Uri.parse(code);
if (uri.getQueryParameterNames().contains("bundle")) {
WXEnvironment.sDynamicMode = uri.getBooleanQueryParameter("debug", false);
WXEnvironment.sDynamicUrl = uri.getQueryParameter("bundle");
String tip = WXEnvironment.sDynamicMode ? "Has switched to Dynamic Mode" : "Has switched to Normal Mode";
Toast.makeText(this, tip, Toast.LENGTH_SHORT).show();
finish();
return;
} else if (uri.getQueryParameterNames().contains("_wx_devtool")) {
WXEnvironment.sRemoteDebugProxyUrl = uri.getQueryParameter("_wx_devtool");
WXEnvironment.sDebugServerConnectable = true;
WXSDKEngine.reload();
Toast.makeText(this, "devtool", Toast.LENGTH_SHORT).show();
return;
} else if (code.contains("_wx_debug")) {
uri = Uri.parse(code);
String debug_url = uri.getQueryParameter("_wx_debug");
WXSDKEngine.switchDebugModel(true, debug_url);
finish();
} else {
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
// intent.setPackage(getPackageName());
intent.setData(Uri.parse(code));
startActivity(intent);
}
}
}
示例12: initBundle
import android.text.TextUtils; //导入方法依赖的package包/类
@Override
protected boolean initBundle(Bundle bundle) {
user = (User) bundle.getSerializable(KEY_BUNDLE);
if (user == null || (user.getId() <= 0 && TextUtils.isEmpty(user.getName())
&& TextUtils.isEmpty(user.getSuffix()))) {
Toast.makeText(this, "没有此用户", Toast.LENGTH_SHORT).show();
return false;
}
return super.initBundle(bundle);
}
示例13: purifyIconName
import android.text.TextUtils; //导入方法依赖的package包/类
@NonNull
public static String purifyIconName(String iconName) {
if (TextUtils.isEmpty(iconName)) {
return "";
}
if (iconName.matches(".+?_\\d+")) {
return iconName.substring(0, iconName.lastIndexOf('_'));
}
return iconName;
}
示例14: donateViaWeiXin
import android.text.TextUtils; //导入方法依赖的package包/类
/**
* 微信捐赠
* @param activity activity
* @param qrSavePath 个人收款二维码,可以通过微信生成
*/
public static void donateViaWeiXin(Activity activity, String qrSavePath) {
if (activity == null || TextUtils.isEmpty(qrSavePath)) {
//参数错误
Log.d(TAG, "参数为null");
return;
}
sendPictureStoredBroadcast(activity, qrSavePath);
gotoWeChatQrScan(activity);
}
示例15: isMatched
import android.text.TextUtils; //导入方法依赖的package包/类
public boolean isMatched(String url)
{
if(TextUtils.isEmpty(url)) return false;
Uri uri = Uri.parse(url);
String host = uri.getHost();
if(!TextUtils.isEmpty(host) && TextUtils.equals(this.host, host))
{
if(paramsFilter.isEmpty())
{
return true;
}
else
{
Set<String> queryKeySet = uri.getQueryParameterNames();
if(queryKeySet.isEmpty()) return false;
boolean isAllParamsMatched = true;
for(String paramKey : paramsFilter.keySet())
{
isAllParamsMatched = isAllParamsMatched
&& queryKeySet.contains(paramKey)
&& TextUtils.equals(paramsFilter.get(paramKey), uri.getQueryParameter(paramKey));
}
return isAllParamsMatched;
}
}
return false;
}