0

我如何能够将字符串从一个活动调用到另一个活动?我的代码不起作用,我正在尝试实现一个可以浏览手机 SD 卡上的图像并返回图像地址的程序。我正在开发一个基于 zxing 库的二维码解码器。

 private void onFileClick(Option o)
{
    //Toast.makeText(this, "File Clicked: "+o.getName(), Toast.LENGTH_SHORT).show();
    Toast.makeText(this, "File Clicked: "+o.getPath(), Toast.LENGTH_SHORT).show();
    QRDecoder qr = null;
    str = o.getPath();
    qr.setFile(str);
    Intent intent = new Intent(this, QRDecoder.class);
    Log.d("filter", str);
    Log.d("filter", qr.my_url);
    startActivity(intent);
}
4

1 回答 1

0

在调用 startActivity 之前 intent.putExtra("path", str);

在 QRDecoder 的 onCreate 中

String path = getIntent().getStringExtra("path");

于 2013-02-11T20:51:11.213 回答