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


Java ClipboardManager.hasText方法代码示例

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


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

示例1: doPaste

import android.text.ClipboardManager; //导入方法依赖的package包/类
private void doPaste() {
    ClipboardManager clip = (ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE);
    if(!clip.hasText()){
        Toast tt = Toast.makeText(this, "No text to Paste..", Toast.LENGTH_SHORT);
        tt.show();
        return;
    }

    CharSequence paste = clip.getText();
    byte[] utf8;
    try {
        utf8 = paste.toString().getBytes("UTF-8");
    } catch (UnsupportedEncodingException e) {
        Log.e(TermDebug.LOG_TAG, "UTF-8 encoding not found.");
        return;
    }

    getCurrentTermSession().write(paste.toString());
}
 
开发者ID:dyne,项目名称:ZShaolin,代码行数:20,代码来源:Term.java

示例2: onClick

import android.text.ClipboardManager; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
  ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
  // Should always be true, because we grey out the clipboard button in onResume() if it's empty
  if (clipboard.hasText()) {
    launchSearch(clipboard.getText().toString());
  }
}
 
开发者ID:atomsheep,项目名称:sres-app,代码行数:9,代码来源:ShareActivity.java

示例3: copySectionContent

import android.text.ClipboardManager; //导入方法依赖的package包/类
private void copySectionContent(int sectionPosition) {
	Section s = (Section)mSectionAdapter.getItem(sectionPosition);
	String content = getSectionContentInShareMode(s);

   	ClipboardManager board = (ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE);
   	board.setText(content);
   	if (board.hasText()) {
   		Toast.makeText(this, R.string.copied, Toast.LENGTH_LONG).show();
   	}
}
 
开发者ID:johnidelight,项目名称:bible-assistant,代码行数:11,代码来源:BookContentActivity.java

示例4: onClick

import android.text.ClipboardManager; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
    ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
    // Should always be true, because we grey out the clipboard button in onResume() if it's empty
    if (clipboard.hasText()) {
        launchSearch(clipboard.getText().toString());
    }
}
 
开发者ID:yakovenkodenis,项目名称:Discounty,代码行数:9,代码来源:ShareActivity.java

示例5: fromClipBoard

import android.text.ClipboardManager; //导入方法依赖的package包/类
private String fromClipBoard() {
    ClipboardManager cm = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
    if (cm.hasText()) {
        return cm.getText().toString();
    }
    doToast(getString(R.string.err_no_clip_text));
    return null;
}
 
开发者ID:SrivatsavPyda99,项目名称:ChessAppVoiceRecognition,代码行数:9,代码来源:main.java

示例6: process

import android.text.ClipboardManager; //导入方法依赖的package包/类
public void process(final Context context){
	Looper.prepare(); //TODO: review it CAREFULLY
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB){
		clipboardNew = (android.content.ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
		processFailed = !clipboardNew.hasText();
		processed = true;
	} else {
		clipboardOld = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
		processFailed = !clipboardOld.hasText();
		processed = true;
	}
}
 
开发者ID:syniuhin,项目名称:Readily,代码行数:13,代码来源:ClipboardReadable.java

示例7: canPaste

import android.text.ClipboardManager; //导入方法依赖的package包/类
private boolean canPaste() {
    ClipboardManager clip = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
    if (clip.hasText()) {
        return true;
    }
    return false;
}
 
开发者ID:dyne,项目名称:ZShaolin,代码行数:8,代码来源:Term.java

示例8: onClick

import android.text.ClipboardManager; //导入方法依赖的package包/类
public void onClick(View v) {
  ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
  // Should always be true, because we grey out the clipboard button in onResume() if it's empty
  if (clipboard.hasText()) {
    launchSearch(clipboard.getText().toString());
  }
}
 
开发者ID:saqimtiaz,项目名称:BibSearch,代码行数:8,代码来源:ShareActivity.java

示例9: onResume

import android.text.ClipboardManager; //导入方法依赖的package包/类
@Override
protected void onResume() {
  super.onResume();

  ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
  if (clipboard.hasText()) {
    clipboardButton.setEnabled(true);
    clipboardButton.setText(R.string.button_share_clipboard);
  } else {
    clipboardButton.setEnabled(false);
    clipboardButton.setText(R.string.button_clipboard_empty);
  }
}
 
开发者ID:saqimtiaz,项目名称:BibSearch,代码行数:14,代码来源:ShareActivity.java


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