2011-10-10 55 views
0

希望這裏有一個簡單的問題,我有一個使用Zxing的條形碼掃描器,這是一個代碼提取(class1)。我試圖把這個與數據庫(class2)掛鉤。我怎樣才能使用(「SCAN_RESULT」)。在我的數據庫類中,我認爲我是正確的行voky,但似乎無法完成它!Android數據庫字符串訪問

Class1的

public void onActivityResult(int requestCode, int resultCode, Intent intent) { 
    if (requestCode == 0) { 
     if (resultCode == RESULT_OK) { 
      String contents = intent.getStringExtra("SCAN_RESULT"); 
      contents.????? 


      Intent intent2 = new Intent("com.new.data"); 
      startActivityForResult(intent2, 1); 

的Class2

String b_code = ?????; 
ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); 
nameValuePairs.add(new BasicNameValuePair("Barcode", b_code)); 

如何開始服用這種從一類到其他任何想法?

幫助大大appriciated!

非常感謝

回答

0

使用

intent2.putExtra("keyName", contents); 

String contents = getIntent().getStringExtra("keyName"); 
+0

要命的感謝送與其他班的意圖和訪問內容作爲字符串非常多,用這種掙扎!非常感謝 – user985644

+0

在這種情況下,接受答案。 –