开发者

Android string access for database

hopefully a simple question here, i have a barcode scanner using Zxing, this is an extract of the code(class1). I am trying to hook this up with a datbase(class2). How can i use the ("SCAN_RESULT"). In my database class think i am vaugly on the right lines but can't seem to comlete it!

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));

Any ideas on how to begin taking this from one开发者_如何学Go class to another?

Help greatly appriciated!

Many Thanks


use

intent2.putExtra("keyName", contents);

to send contents as string with intent and access in the other class with

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜