Unable to set focus in editText

Job ID: 35792286

Budget: ₹100 – ₹400 INR

After tapping the button, I am trying to set focus in edit text.

Due to some reasons, it is not working. Here is the code below

btnscan.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.gamma.scan");
if (launchIntent != null) {
try{
startActivity(launchIntent);
txtUPC.requestFocus();
}catch(Exception e){
e.printStackTrace();
}
}
}
});
Related categories: Android Android Studio