Skip to content Skip to sidebar Skip to footer

Android - Barcode Fragment Result Not Displaying

[SOLVED] The apps work fine without crash, but it should be update the resultView text from 'Hasil Scan' to the scan result, but it doesnt. The problem are the textview (resultView

Solution 1:

I think the problem is the onActivityResult is not called in the ScanFragment

First you should override the onActivityResult(int rc,int res, Intent data) on the MainActivity

 @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.frame_layout);
    if (fragment != null) {
        fragment.onActivityResult(requestCode, resultCode, data);
    }
}

This code it will help you call the onActivityResult on the ScanFragment.


Post a Comment for "Android - Barcode Fragment Result Not Displaying"