从条形码产品获取更多信息 [英] Get more information from bar code product

查看:87
本文介绍了从条形码产品获取更多信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在android中创建了一个简单的程序,其中获取条形码产品。条形码产品包含一个数字。所以我想获得更多信息,例如我想获得产品名称,地址和更多信息。以下是获取条形码的代码。



I created a simple program in android in which get the Bar code product. The Bar code product contain a number.So I want to get more information for example I want to get the product name,address and more information. The following is the code which get the Bar code.

public class MainActivity extends AppCompatActivity {
                  Button br;
               static final String ACTION_SCAN =
               "com.google.zxing.client.android.SCAN";

             @Override
          protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);

               br=(Button)findViewById(R.id.br);


   brcode.setOnClickListener(new View.OnClickListener() {
       @Override
       public void onClick(View view) {
           try {

               Intent intent = new Intent(ACTION_SCAN);
               intent.putExtra("SCAN_MODE", "PRODUCT_MODE");
               startActivityForResult(intent, 0);
              } catch (ActivityNotFoundException e) {
               showDialog(MainActivity.this, "No Scanner Found in your
                    device",
                       "Download a scanner?", "Yes", "No").show();
             }


            }
            });

             }


       @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent
               intent) {
      if(requestCode == 0) {


         if(resultCode == RESULT_OK) {
           contents   = intent.getStringExtra("SCAN_RESULT");
           String format = intent.getStringExtra("SCAN_RESULT_FORMAT");

           streetView.setText("CONTENT:"+contents+"\n"+"Formate:"+format);

              }





我的尝试:



所以我想获得更多关于这个产品的信息并在TextView上显示。



What I have tried:

So I want to get more information of this product and show on TextView.

推荐答案

好的,所以你我需要一个数据库,其中包含您想要与该条形码相关联的所有信息。



如果您在谈论几乎所有产品的条形码在商店货架上发现它在美国被称为UPC或通用产品代码。有数据库,但没有一个完全免费。
OK, so you're going to need a database that has all the information you want associated with that barcode.

If you're talking about the barcode you find on just about every product found on store shelves its called a "UPC" or "Universal Product Code" in the US. There are databases out there, but none of them are completely free.


这篇关于从条形码产品获取更多信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆