0

I have come across a problem where the screen of my Android device(Moto G2) gets blurred on click of a specific button in my app. This event happens occasionally and not everytime I click this button. This scenario is not happening on few other devices (like LG G3) in which I have tested the app for some time. I couldnot find anything related or useful in the Logs either. Just to add, the Log in button which is posing this issue is in a view of a fragment attached.

A screenshot of the scenario :

Adding code in the Activity's onCreate() where it adds the Fragments :

 if (savedInstanceState == null) {
            facebookLoginBtnFragment = new FacebookLoginBtnFragment();
            getSupportFragmentManager().beginTransaction()
                    .add(R.id.container, facebookLoginBtnFragment).commit();
           googleLoginBtnFragment = new GoogleLoginBtnFragment();
            getSupportFragmentManager().beginTransaction()
                    .add(R.id.container2, googleLoginBtnFragment).commit();

        } else {
            facebookLoginBtnFragment = (FacebookLoginBtnFragment)getSupportFragmentManager().findFragmentById(R.id.container);
            googleLoginBtnFragment = (GoogleLoginBtnFragment)getSupportFragmentManager().findFragmentById(R.id.container2);
        }

Below is the code of onCreateView() of the Google + fragment :

public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 
     View rootView = inflater.inflate(R.layout.fragment_gplusloginbtns, container, false);
     gplusButton = (SignInButton)rootView.findViewById(R.id.GPlus_Sign_in_button); gplusButton.setOnClickListener(this);
     setGooglePlusButtonText(gplusButton, "Log in with Google");
     rootView.findViewById(R.id.GPlus_sign_out_button).setOnClickListener(this);
     if (mActivity.getClass().toString().contains("ShowProfile_act")) {
         rootView.findViewById(R.id.GPlus_Sign_in_button).setVisibility(View.GONE);
     } mConnectionProgressDialog = new ProgressDialog(getActivity());    mConnectionProgressDialog.setMessage("Logging in...");
     return rootView;
 }

Below is the code for setGooglePlusButtonText() method :

private void setGooglePlusButtonText(SignInButton signInButton, String buttonText) {
// Find the TextView that is inside of the SignInButton and set its text
        for (int i = 0; i < signInButton.getChildCount(); i++) {
            View v = signInButton.getChildAt(i);
            if (v instanceof TextView) {
                TextView tv = (TextView) v;
                tv.setText(buttonText);
                return;
            }
        }
}

-->The others methods of the fragment deal with connection maintenance part with the Google+ API.I assume they might not be relevant Any suggestions, advices on the cause and how to avoid such scenarios would be helpful.

Mikki
  • 128
  • 2
  • 12

0 Answers0