0

I am trying to blur background when i call fragment but it did'nt work. i use set alpha but my app crash

     Fragment fragment = new Admin();
 FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
                   fragmentTransaction.setCustomAnimations(R.anim.slide_in_down, R.anim.slide_in_down);

        fragmentTransaction.replace(R.id.frame, fragment);
                 listView.getBackground().setAlpha(200);//this is error
                fragmentTransaction.commit();
               }


      java.lang.NullPointerException: Attempt to invoke virtual method 'void android.graphics.drawable.Drawable.setAlpha(int)' on a null object reference
     atcom.developers.studentsplacementsystem.MainActivity$1.onItemClick(MainActivity.java:48)
            at android.widget.AdapterView.performItemClick(AdapterView.java:350)
            at android.widget.AbsListView.performItemClick(AbsListView.java:1683)
            at android.widget.AbsListView$PerformClick.run(AbsListView.java:4094)
M adnan
  • 3
  • 3
  • 1
    your `listView` is `null`. – Sajith Jul 17 '19 at 14:41
  • Please post you're full Code of fragment. So we can see what variable name you used for layoutinflator. – Ashish Jul 17 '19 at 14:54
  • 2
    Possible duplicate of [What is a NullPointerException, and how do I fix it?](https://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it) – Gustavo Jul 17 '19 at 15:01

0 Answers0