當前位置: 首頁>>代碼示例>>Java>>正文


Java IntentResult.getFormatName方法代碼示例

本文整理匯總了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);
}
 
開發者ID:syntafin,項目名稱:TenguChat,代碼行數:20,代碼來源:VerifyOTRActivity.java

示例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);
}
 
開發者ID:xavierle,項目名稱:messengerxmpp,代碼行數:19,代碼來源:StartConversationActivity.java

示例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);
}
 
開發者ID:kriztan,項目名稱:Pix-Art-Messenger,代碼行數:20,代碼來源:VerifyOTRActivity.java

示例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();
    }
}
 
開發者ID:cs493f15-1,項目名稱:PaperOrPlastic,代碼行數:20,代碼來源:ItemSearchActivity.java

示例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();

    }


}
 
開發者ID:tarasM,項目名稱:Bozon.kg_App,代碼行數:27,代碼來源:Main_screen.java

示例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;
		}
	}
}
 
開發者ID:emdete,項目名稱:Simplicissimus,代碼行數:19,代碼來源:Sample.java

示例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();
    }

}
 
開發者ID:aviary48,項目名稱:Ampath-QR-code-scanner,代碼行數:19,代碼來源:MainActivity.java

示例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();
    }
}
 
開發者ID:adelolmo,項目名稱:biblio,代碼行數:26,代碼來源:BiblioActivity.java

示例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);
    }
}
 
開發者ID:Fr4gorSoftware,項目名稱:SecScanQR,代碼行數:34,代碼來源:MainActivity.java

示例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);
        }
    }
}
 
開發者ID:vooratarun,項目名稱:BookBarcodeScanner,代碼行數:38,代碼來源:MainActivity.java

示例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;
        }
    }
}
 
開發者ID:syntafin,項目名稱:TenguChat,代碼行數:14,代碼來源:OmemoActivity.java

示例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();
    }
}
 
開發者ID:brarcher,項目名稱:loyalty-card-locker,代碼行數:38,代碼來源:LoyaltyCardViewActivity.java

示例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();
    }
}
 
開發者ID:miguelpalacio,項目名稱:MyMacros,代碼行數:14,代碼來源:MainActivity.java

示例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);
}
 
開發者ID:kriztan,項目名稱:Pix-Art-Messenger,代碼行數:16,代碼來源:UriHandlerActivity.java

示例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();
        }
    }
}
 
開發者ID:SirRujak,項目名稱:DellWarrantyInfo,代碼行數:30,代碼來源:MyActivity.java


注:本文中的com.google.zxing.integration.android.IntentResult.getFormatName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。