title: Android Custom ArrayAdapter in Fragment
body: <p>Hi i'm working on just making a simple list i just want an icon title and description and putting it in a fragment since it's part of a viewpager however i'm getting a nullpointerexception and i can't figure out why. My code looks like this and all my other pages are fine it's just this list i can't get to work.</p>
  
  <pre><code>public class Test extends Fragment{
  
      View view;
      Context context;
      public static ListView lView;
      public static ArrayAdapter&lt;String&gt; leftList;
  
      public class MyCustomAdapter extends ArrayAdapter&lt;String&gt; {
          public MyCustomAdapter(Context context, int resource, int textViewResourceId, String[] dayOfWeek) {
              super(context, resource, textViewResourceId, dayOfWeek);
          }
  
          @Override
          public View getView(int position, View convertView, ViewGroup parent) {
              TextView label=(TextView)view.findViewById(R.id.rowTextView);
              label.setText(DayOfWeek[position]);
              ImageView icon=(ImageView)view.findViewById(R.id.listIcon);
              if (DayOfWeek[position]=="Sunday"){
                  icon.setImageResource(R.drawable.file);
              }else{
                  icon.setImageResource(R.drawable.icon);
              }
              TextView desc = (TextView)view.findViewById(R.id.description);
              if (DayOfWeek[position]=="Sunday"){
                  desc.setText("Description1");
              }else{
                  desc.setText("desc");
              }
              return view;
          }
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 
          view = inflater.inflate(R.layout.leftlist, null);
          LinearLayout pasteLayout=(LinearLayout)view.findViewById(R.id.bottomBar);
          pasteLayout.setVisibility(LinearLayout.GONE);
          context = getActivity();
          lView = (ListView) view.findViewById(R.id.ListView01);
          Test est = new Test();
          Test.MyCustomAdapter teS = est.new MyCustomAdapter(context, R.layout.row, R.id.rowTextView, DayOfWeek);
          leftList = teS;
          lView.setAdapter(leftList);
          return view;
      }
  
  
      String[] DayOfWeek = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
  }
  </code></pre>
  
  <p><strong>The error in logcat</strong></p>
  
  <pre><code>E/AndroidRuntime( 1304): java.lang.NullPointerException
  E/AndroidRuntime( 1304):    at com.testing.Test$MyCustomAdapter.getView(Test.java:29)
  E/AndroidRuntime( 1304):    at android.widget.AbsListView.obtainView(AbsListView.java:1445)
  E/AndroidRuntime( 1304):    at android.widget.ListView.measureHeightOfChildren(ListView.java:1220)
  E/AndroidRuntime( 1304):    at android.widget.ListView.onMeasure(ListView.java:1131)
  E/AndroidRuntime( 1304):    at android.view.View.measure(View.java:8363)
  E/AndroidRuntime( 1304):    at android.widget.RelativeLayout.measureChild(RelativeLayout.java:566)
  E/AndroidRuntime( 1304):    at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:381)
  E/AndroidRuntime( 1304):    at android.view.View.measure(View.java:8363)
  E/AndroidRuntime( 1304):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3160)
  E/AndroidRuntime( 1304):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
  E/AndroidRuntime( 1304):    at android.view.View.measure(View.java:8363)
  E/AndroidRuntime( 1304):    at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:595)
  E/AndroidRuntime( 1304):    at android.view.View.measure(View.java:8363)
  E/AndroidRuntime( 1304):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3160)
  E/AndroidRuntime( 1304):    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
  E/AndroidRuntime( 1304):    at android.widget.LinearLayout.measureVertical(LinearLayout.java:386)
  E/AndroidRuntime( 1304):    at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
  E/AndroidRuntime( 1304):    at android.view.View.measure(View.java:8363)
  E/AndroidRuntime( 1304):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3160)
  E/AndroidRuntime( 1304):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
  E/AndroidRuntime( 1304):    at android.view.View.measure(View.java:8363)
  E/AndroidRuntime( 1304):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3160)
  E/AndroidRuntime( 1304):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
  E/AndroidRuntime( 1304):    at android.view.View.measure(View.java:8363)
  E/AndroidRuntime( 1304):    at android.view.ViewRoot.performTraversals(ViewRoot.java:841)
  E/AndroidRuntime( 1304):    at android.view.ViewRoot.handleMessage(ViewRoot.java:1873)
  E/AndroidRuntime( 1304):    at android.os.Handler.dispatchMessage(Handler.java:99)
  E/AndroidRuntime( 1304):    at android.os.Looper.loop(Looper.java:130)
  E/AndroidRuntime( 1304):    at android.app.ActivityThread.main(ActivityThread.java:3703)
  E/AndroidRuntime( 1304):    at java.lang.reflect.Method.invokeNative(Native Method)
  E/AndroidRuntime( 1304):    at java.lang.reflect.Method.invoke(Method.java:507)
  E/AndroidRuntime( 1304):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
  E/AndroidRuntime( 1304):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
  E/AndroidRuntime( 1304):    at dalvik.system.NativeStart.main(Native Method)
  W/ActivityManager(  278):   Force finishing activity com.testing/.MainActivity
  W/ActivityManager(  278): Activity pause timeout for HistoryRecord{408d4540 com.testing/.MainActivity}
  </code></pre>
  
  <p>Any help would be greatly appreciated thanks a ton really hoping i can get this working i think i'm really close :)</p>