没有任何错误信息,只是textView没有得到值,具体代码如下:
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private Button btr;
private TextView tv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initView();
listen();
}
private void listen() {
btr.setOnClickListener(this);
tv.setOnClickListener(this);
}
private void initView() {
btr = (Button) findViewById(R.id.button);
tv = (TextView) findViewById(R.id.tv);
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.button:
startActivityForResult(new Intent(MainActivity.this, CaptureActivity.class),0);
break;
}
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Bundle bundle = data.getExtras();
String theresult = bundle.getString("result");
tv.setText(theresult);
}
}