本文整理匯總了Java中com.google.zxing.integration.android.IntentResult.getFormatName方法的典型用法代碼示例。如果您正苦於以下問題:Java IntentResult.getFormatName方法的具體用法?Java IntentResult.getFormatName怎麽用?Java IntentResult.getFormatName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.zxing.integration.android.IntentResult
的用法示例。
在下文中一共展示了IntentResult.getFormatName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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);
}
示例4: 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)
{
String scanContent = scanningResult.getContents ();
String scanFormat = scanningResult.getFormatName ();
formatText.setText ("FORMAT: " + scanFormat);
contentText.setText ("CONTENT: " + scanContent);
}
else
{
Toast toast = Toast.makeText (getApplicationContext (), "No scan data received!",
Toast.LENGTH_SHORT);
toast.show();
}
}
示例5: 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();
}
}
示例6: onActivityResult
import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
switch (requestCode & 0xFFFF) {
case IntentIntegrator.REQUEST_CODE: {
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if (scanResult != null && scanResult.getFormatName() != null) {
String data = scanResult.getContents();
Log.d(TAG, "data: " + data);
scan.setText(data);
}
break;
}
default: {
super.onActivityResult(requestCode, resultCode, intent);
break;
}
}
}
示例7: onActivityResult
import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
//retrieve scan result
IntentResult scanningResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if (scanningResult != null) {
//we have a result
String scanContent = scanningResult.getContents();
String scanFormat = scanningResult.getFormatName();
formatTxt.setText("FORMAT: " + scanFormat);
contentTxt.setText("CONTENT: " + scanContent);
}
else{
Toast toast = Toast.makeText(getApplicationContext(),
"No scan data received!", Toast.LENGTH_SHORT);
toast.show();
}
}
示例8: onActivityResult
import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
Log.d(TAG, "onActivityResult - requestCode[" + requestCode + "] resultCode[" + resultCode + "] intent[" + intent + "].");
Log.d(TAG, "intent [" + (intent != null ? intent.getDataString() : "empty") + "].");
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if (scanResult != null) {
String contents = scanResult.getContents();
String format = scanResult.getFormatName();
Log.d(TAG, "Result. content [" + contents + "] format [" + format + "].");
final Intent bookInfoIntent = new Intent(this, BookInfoActivity.class);
bookInfoIntent.putExtra("link", sharedPreferences.getString("link", null));
bookInfoIntent.putExtra("format", format);
bookInfoIntent.putExtra("code", contents);
startActivity(bookInfoIntent);
} else {
// Handle cancel
Log.e(TAG, "Scan was cancelled");
Toast toast = Toast.makeText(this, "Scan was Cancelled!", Toast.LENGTH_LONG);
toast.setGravity(Gravity.TOP, 25, 400);
toast.show();
}
}
示例9: 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 {
qrcodeFormat = result.getFormatName();
qrcode = result.getContents();
if(!qrcode.equals("")){
mTvFormat.setVisibility(View.VISIBLE);
mLabelInformation.setVisibility(View.VISIBLE);
mLabelFormat.setVisibility(View.VISIBLE);
mTvFormat.setText(qrcodeFormat);
mTvInformation.setText(qrcode);
action_navigation.setVisibility(View.VISIBLE);
addToDatabase(mTvInformation.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(mTvInformation, qrcode, activity);
}
}
}
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}
示例10: onActivityResult
import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
Toast.makeText(this, "Scan Completed..", Toast.LENGTH_SHORT).show();
//get the extras that are returned from the intent
String contents = intent.getStringExtra("SCAN_RESULT");
String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
Log.d("ScanResult",contents);
// We got product ISBN number and so get googlebook details
bookDetailsByISBN(contents);
}
} else {
IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if(result != null) {
if(result.getContents() == null) {
Toast.makeText(this, "Cancelled", Toast.LENGTH_LONG).show();
} else {
Log.d("MainActivity", "Scanned");
String scanContent = result.getContents();
String scanFormat = result.getFormatName();
if(scanContent != null && scanFormat != null && scanFormat.equalsIgnoreCase("EAN_13")){
Toast.makeText(this, "Scanned: " + scanContent, Toast.LENGTH_LONG).show();
bookDetailsByISBN(scanContent);
} else{
Toast toast = Toast.makeText(getApplicationContext(), "Not a valid scan!", Toast.LENGTH_SHORT);
toast.show();
}
}
} else {
super.onActivityResult(requestCode, resultCode, intent);
}
}
}
示例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.getFormatName() != null) {
String data = scanResult.getContents();
XmppUri uri = new XmppUri(data);
if (xmppConnectionServiceBound) {
processFingerprintVerification(uri);
} else {
this.mPendingFingerprintVerificationUri =uri;
}
}
}
示例12: onActivityResult
import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent)
{
String contents = null;
String format = null;
IntentResult result =
IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if (result != null)
{
Log.i(TAG, "Received barcode information from capture");
contents = result.getContents();
format = result.getFormatName();
}
if(requestCode == SELECT_BARCODE_REQUEST && resultCode == Activity.RESULT_OK)
{
Log.i(TAG, "Received barcode information from capture");
contents = intent.getStringExtra(BarcodeSelectorActivity.BARCODE_CONTENTS);
format = intent.getStringExtra(BarcodeSelectorActivity.BARCODE_FORMAT);
}
if(contents != null && contents.isEmpty() == false &&
format != null && format.isEmpty() == false)
{
Log.i(TAG, "Read barcode id: " + contents);
Log.i(TAG, "Read format: " + format);
TextView cardIdView = (TextView)findViewById(R.id.cardIdView);
cardIdView.setText(contents);
final TextView barcodeTypeField = (TextView) findViewById(R.id.barcodeType);
barcodeTypeField.setText(format);
onResume();
}
}
示例13: 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) {
barcodeScanFormat = scanningResult.getFormatName();
barcodeScanResult = scanningResult.getContents();
if (barcodeScanFormat != null && barcodeScanResult != null) {
productScanned = true;
}
} else {
Toast.makeText(this, "No scan data received", Toast.LENGTH_SHORT).show();
}
}
示例14: 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();
handleUri(Uri.parse(data));
}
}
finish();
super.onActivityResult(requestCode, requestCode, intent);
}
示例15: onActivityResult
import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
public void onActivityResult( int requestCode, int resultCode, Intent intent) {
//retrieve scan result
if (isFetching == false) {
isFetching = true;
IntentResult scanningResult = IntentIntegrator.parseActivityResult(
requestCode,
resultCode,
intent);
if (scanningResult != null && intent !=null) {
//we have a result
String scanContent = scanningResult.getContents();
String scanFormat = scanningResult.getFormatName();
this.fetchData(scanContent);
//new HttpAsyncTask(this, updateListView).execute("167L22S"); //for testing purposes
} else {
this.isFetching = false;
Toast toast = Toast.makeText(
getApplicationContext(),
"No scan data received!", Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER,0,0);
toast.show();
}
}
}