本文整理匯總了Java中com.google.zxing.integration.android.IntentResult.getContents方法的典型用法代碼示例。如果您正苦於以下問題:Java IntentResult.getContents方法的具體用法?Java IntentResult.getContents怎麽用?Java IntentResult.getContents使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.zxing.integration.android.IntentResult
的用法示例。
在下文中一共展示了IntentResult.getContents方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onActivityResult
import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == IntentIntegrator.REQUEST_CODE) {
// 掃描二維碼回傳值
IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
String ewmString = result.getContents();
Intent mintent = new Intent(MainActivity.this, QuickWebLoader.class);
QuickBean bean = new QuickBean(ewmString);
mintent.putExtra("bean", bean);
startActivity(mintent);
}
}
}
示例2: onActivityResult
import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
/**
* This method handles the results of the scan
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
if(result != null){
if(result.getContents()==null){
Toast.makeText(this, getResources().getText(R.string.error_canceled_scan), Toast.LENGTH_LONG).show();
} else {
qrcode = result.getContents();
if(!qrcode.equals("")){
mTextMessage.setText(qrcode);
action_navigation.setVisibility(View.VISIBLE);
addToDatabase(mTextMessage.getText().toString());
//Automatic Clipboard if activated
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
String auto_scan = prefs.getString("pref_auto_clipboard", "");
if(auto_scan.equals("true")){
copyToClipboard(mTextMessage, qrcode, activity);
}
}
}
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}
示例3: onActivityResult
import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
IntentResult result = IntentIntegrator.parseActivityResult( requestCode, resultCode, data);
if (result != null) {
if ( result.getContents() == null) {
this.scan = null;
long newInstance = Calendar.getInstance().getTimeInMillis();
if ( newInstance - this.startScannerTime < 1000 * this.timeOutSecond ) {
this.onCanceled();
} else {
this.onTimeOut();
}
} else {
this.scan = new Scan( result.getContents() );
ScanDao scanDao = new ScanDao( this );
scanDao.register( this.scan);
this.onScanReaderResult( this.scan );
}
}
}
示例4: onActivityResult
import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
if(result != null) {
if(result.getContents() != null) {
QRReadTask task = new QRReadTask();
task.execute(result.getContents());
if (EssensbonUtils.isAutoFadeEnabled()) {
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
integrator.initiateScan();
}
}, EssensbonUtils.getFadeTime()*1000);
}
}
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}
示例5: onActivityResult
import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
IntentResult intentResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
if(intentResult!= null){
if(intentResult.getContents()==null){
Toast.makeText(this,"Scanning Stopped", Toast.LENGTH_LONG).show();
}else
{
Toast.makeText(this, intentResult.getContents(), Toast.LENGTH_SHORT).show();
}
}else
{
super.onActivityResult(requestCode, resultCode, data);
}
}
示例6: onActivityResult
import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if ((requestCode & 0xFFFF) == IntentIntegrator.REQUEST_CODE) {
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if (scanResult != null && scanResult.getFormatName() != null) {
String data = scanResult.getContents();
XmppUri uri = new XmppUri(data);
if (xmppConnectionServiceBound) {
verifyWithUri(uri);
finish();
} else {
this.mPendingUri = uri;
}
} else {
finish();
}
}
super.onActivityResult(requestCode, requestCode, intent);
}
示例7: onActivityResult
import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
if(result != null) {
if(result.getContents() == null) {
Log.d("MainActivity", "Cancelled scan");
Toast.makeText(this, "Cancelled", Toast.LENGTH_LONG).show();
} else {
Log.d("MainActivity", "Scanned");
Toast.makeText(this, "Scanned: " + result.getContents(), Toast.LENGTH_LONG).show();
}
} else {
// This is important, otherwise the result will not be passed to the fragment
super.onActivityResult(requestCode, resultCode, data);
}
}
示例8: onActivityResult
import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent)
{
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if (scanResult != null && scanResult.getContents() != null)
{
String url = scanResult.getContents();
try
{
new URL(url);
urlEditText.setText(url);
}
catch(MalformedURLException e)
{
AlertDialog alertDialog = createAlertDialog(this, "Not an URL", "The read QRCode does not represent a valid URL.", null, 1, "Ok", null, null);
alertDialog.show();
}
}
}
開發者ID:judax,項目名稱:OculusMobileSDKHeadTrackingXWalkViewExtension,代碼行數:20,代碼來源:OculusMobileSDKHeadTrackingURLEntryActivity.java
示例9: onActivityResult
import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if ((requestCode & 0xFFFF) == IntentIntegrator.REQUEST_CODE) {
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if (scanResult != null && scanResult.getFormatName() != null) {
String data = scanResult.getContents();
Invite invite = new Invite(data);
if (xmppConnectionServiceBound) {
invite.invite();
} else if (invite.getJid() != null) {
this.mPendingInvite = invite;
} else {
this.mPendingInvite = null;
}
}
}
super.onActivityResult(requestCode, requestCode, intent);
}
示例10: onActivityResult
import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
/**
* Receives value of scanned QR code and sets it as device ID.
*/
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if (scanResult != null) {
String deviceId = scanResult.getContents();
if (!isBlank(deviceId)) {
Log.i("Main", "qrcode text = " + deviceId);
importDeviceId(deviceId);
return;
}
}
if (resultCode == Activity.RESULT_OK) {
Uri fileUri = intent.getData();
doUpload(indexBrowser.getFolder(), indexBrowser.getCurrentPath(), Arrays.asList(fileUri));
}
}
示例11: onActivityResult
import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if ((scanResult != null) && (scanResult.getContents() != null)) {
String data = scanResult.getContents();
if (data.equals(Base64.encodeBytes(getIdentityKeyToCompare().serialize()))) {
Dialogs.showInfoDialog(this, getVerifiedTitle(), getVerifiedMessage());
} else {
Dialogs.showAlertDialog(this, getNotVerifiedTitle(), getNotVerifiedMessage());
}
} else {
Toast.makeText(this, R.string.KeyScanningActivity_no_scanned_key_found_exclamation,
Toast.LENGTH_LONG).show();
}
}
示例12: onActivityResult
import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode != Activity.RESULT_OK) {
return;
}
if (requestCode == IntentIntegrator.REQUEST_CODE) {
IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
if(result != null) {
if(result.getContents() == null) {
Toast.makeText(this, "掃碼取消!", Toast.LENGTH_SHORT).show();
} else {
mInputTextTV.setText(result.getContents());
}
}
}
}
示例13: onActivityResult
import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
/**
* Gets called when the QR code was read is provided by zxing
*/
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
// Cancel if activity result is not a QR code scan result
IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if (result == null) {
super.onActivityResult(requestCode, resultCode, intent);
return;
}
// User cancelled QR code scanning?
if (result.getContents() == null) {
Toast.makeText(getActivity(), R.string.canceled_toast, Toast.LENGTH_LONG).show();
return;
}
qrData = result.getContents();
tryHandleQRData();
}
示例14: onActivityResult
import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
IntentResult scanningResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if (scanningResult != null) {
AlertDialog.Builder builder = new AlertDialog.Builder(Main_screen.this);
String scanContent = scanningResult.getContents();
String scanFormat = scanningResult.getFormatName();
builder.setTitle("Инфо о продукте.")
.setMessage("FORMAT: " + scanFormat + "\n" + "CONTENT: " + scanContent)
.setPositiveButton("ОК", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
builder.show();
} else {
Toast toast = Toast.makeText(getApplicationContext(),
"No scan data received!", Toast.LENGTH_SHORT);
toast.show();
}
}
示例15: onActivityResult
import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
/**
* Handle Activity Results
* @param requestCode requestCode
* @param resultCode resultCode (RESULT_SETTINGS is defined at the top)
* @param data data
*/
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
//Come back from Settings
case RESULT_SETTINGS:
{
applyPreferenceChanges();
break;
}
// Receive from QR
case IntentIntegrator.REQUEST_CODE:
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
if (scanResult != null) {
String content = scanResult.getContents();
if(content == null) Log.e(APP_ID, "Error! Received nothing from QR-Code!");
else {
Log.d(APP_ID, "Received " + content + " from QR-Code!");
restoreStateFromCode(content);
}
}
}
}