title: setBackgroundDrawable give nullpointerexception in android
body: <p>I am trying to create a circle inside a fragment and I need to change its color in runtime in future.
  but the method <code>setBackgroundDrawable</code> gives me <code>nullPointerException</code>. </p>
  
  <p>I am not able to figure it out as I am web developer and I am new to android development. Please help me.</p>
  
  <p>And the code is below</p>
  
  <pre><code>   public class tester extends Fragment {
      private View circle_holder;
      @SuppressWarnings("deprecation")
      @SuppressLint("NewApi")
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
          View rootView = inflater.inflate(R.layout.today, container, false);
          circle_holder = (View)getActivity().findViewById(R.id.cicle);
          ShapeDrawable mDrawable = new ShapeDrawable(new OvalShape());
          mDrawable.getPaint().setColor(Color.RED);
          if (Build.VERSION.SDK_INT &gt;= 16){
              circle_holder.setBackground(mDrawable);
          }
          else{
              circle_holder.setBackgroundDrawable(mDrawable);
          }
          return rootView;
      }
  }
  </code></pre>