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


Java TextUtils.isEmpty方法代码示例

本文整理汇总了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;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:18,代码来源:UMWXHandler.java

示例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");
}
 
开发者ID:vpaliyX,项目名称:Melophile,代码行数:17,代码来源:UserHandler.java

示例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;
}
 
开发者ID:kuldeep725,项目名称:gogo,代码行数:22,代码来源:Login.java

示例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;
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:10,代码来源:CSSPositionTypeConvert.java

示例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 + ")";
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:10,代码来源:DatabaseUtilsCompat.java

示例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());
}
 
开发者ID:TryGhost,项目名称:Ghost-Android,代码行数:35,代码来源:PostViewActivity.java

示例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));
    }
}
 
开发者ID:ynztlxdeai,项目名称:TextReader,代码行数:29,代码来源:DownloadBookService.java

示例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);
        }
    });
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:15,代码来源:CustomTabActivity.java

示例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();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:35,代码来源:AccountManagementFragment.java

示例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();
    }
}
 
开发者ID:popo1379,项目名称:popomusic,代码行数:9,代码来源:SearchActivity.java

示例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);
            }
        }
    }
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:33,代码来源:WXDebugActivity.java

示例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);
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:11,代码来源:OtherUserHomeActivity.java

示例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;
}
 
开发者ID:homeii,项目名称:GxIconAndroid,代码行数:11,代码来源:ExtraUtil.java

示例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);
}
 
开发者ID:gtf35,项目名称:easyShopping,代码行数:15,代码来源:WeiXinDonate.java

示例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;
}
 
开发者ID:kfrozen,项目名称:DeeplinkRouter,代码行数:36,代码来源:Mapping.java


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