2013-02-11 68 views
0

我將如何能夠從一個活動調用字符串到另一個? 我的代碼不工作,我試圖實現一個程序,可以瀏覽我的手機SD卡上的圖像並返回圖像的地址 。 我正在開發基於zxing庫的QR碼解碼器。QR代碼解碼器,變量的地址問題

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

回答

0

調用startActivity intent.putExtra("path", str);

中的onCreate的QRDecoder

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

之前