i have the following chain of call
in a fragment i call zxing integrator to scan qr code which returns the result in
onActivityResult(int requestCode,int resultCode,Intent data)
of the fragment
The onActivityResult calls an Asynctask,
new getStaffIdTask(choosen_schema_for_scanning,userid).execute((Void)null);
whose onPostExecute(final Boolean success) calls the fragments listener as..
if(mListener!=null)
mListener.onScannedStaff(tableName,Integer.parseInt(id),Integer.parseInt(userid));
Back on the host activity the onScannedStaff function is called and in it replaces a fragment
@Override
public void onScannedStaff(String tableName, int staffid,int staffUid) { getSupportActionBar().setTitle("Staff Profile");
Fragment fragment= StaffProfileFragment.newInstance(tableName,staffid,staffUid);
FragmentTransaction transaction=getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.home_boss_base,fragment,"scannedstaff");
transaction.addToBackStack(null);
transaction.commit();
}
The problem is that this fragment runs in the background and its not showing any UI at all. I cant figure out how to show it
I have also faced the same issue. Use LinearLayout in the fragment. Background color should be white and it should be clickable.
And don't call UI element from OnPostExecute().that will give you some major memory leaks or errors.