title: unable to create list view in android
body: <p>I am passing string array to a bundle from one activity to other I wish to display this string array in list view on 2nd activity.But the list view is not created.Following is the code for same:</p>
  
  <p>//welcome.java</p>
  
  <pre><code>package com.example.eleave;
  import android.app.Activity;
  import android.content.Intent;
  import android.net.ParseException;
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.Toast;
  
  public class Welcome extends Activity {
         int l;
      Button b1,b2;
      EditText e1,e2;
       String result2;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
          setContentView(R.layout.welcome);
          b1=(Button) findViewById(R.id.button1);
          b2=(Button) findViewById(R.id.button2);
          e1=(EditText) findViewById(R.id.editText1);
          e2=(EditText) findViewById(R.id.editText2);
  
          b1.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View arg0) {
                  // TODO Auto-generated method stub
  
                  if(e1.getText().length()==0 ||e2.getText().length()==0)
                  {
                      Toast.makeText(getBaseContext(), "Please Enter all the fields", Toast.LENGTH_LONG).show();
                  }
                  else{
                      String username=e1.getText().toString();
                  String password=e2.getText().toString();
                  AsyncTask&lt;String, Void, String&gt; s=new SignUp(Welcome.this,username,password).execute(username,password);
                  try{
          String result=s.get();
           String password1=password+"0";
             String password2=password+"1";
         if(result.equals(password1))
         {
              Toast.makeText(getBaseContext(),"student", Toast.LENGTH_LONG).show();
              Intent i=new Intent(Welcome.this,LeaveApp.class);
               Bundle b=new Bundle();
                  b.putString("username", username);
                  i.putExtras(b);
              startActivity(i);
         }
         else if(result.equals(password2))
         {
  String usernam[]=new String[20];
              String phone_no1[]=new String[20];
              String reason[]=new String[20];
              String sem[]=new String[20];
              String from_date[]=new String[20];
              String to_date[]=new String[20];
            // Toast.makeText(getBaseContext(), "teacher", Toast.LENGTH_LONG).show();
             AsyncTask&lt;String,Void,String&gt;id1=new CountRows(Welcome.this).execute();
             try{
                 result2= id1.get();
                  l=Integer.parseInt(result2);
             }catch(Exception e)
             {
  
             }
             AsyncTask&lt;String,Void,String&gt;id=new Upload(Welcome.this).execute();
             try{
                String result1= id.get();
              int j=0;
              for(int i=0;i&lt;l;i++)
              {
          String div[]=result1.split("-");
           phone_no1[i]=div[j++];
           reason[i]=div[j++];
           sem[i]=div[j++];
           from_date[i]=div[j++];
           to_date[i]=div[j++];
          // Toast.makeText(getBaseContext(), phone_no1[i], Toast.LENGTH_LONG).show();
  
           AsyncTask&lt;String,Void,String&gt;id3=new GetUser(Welcome.this).execute(phone_no1[i]);
             try{
                String result3= id3.get();
                usernam[i]=result3;
                }catch(Exception e)
                {
  
                }
  
  
  
              }
               Toast.makeText(getBaseContext(), phone_no1[0]+reason[0]+sem[0]+from_date[0]+to_date[0], Toast.LENGTH_LONG).show();
          // Toast.makeText(getBaseContext(),result1, Toast.LENGTH_LONG).show();
             }catch(Exception e)
             {
  
             }
             Intent i=new Intent(Welcome.this,View_Stud.class);
  
                 Bundle bundle =new Bundle();
                 bundle.putStringArray("phoneno",phone_no1);
                 bundle.putStringArray("reason",reason);
                 bundle.putStringArray("sem",sem);
                 bundle.putStringArray("from_date",from_date);
                 bundle.putStringArray("to_date",to_date);
                  bundle.putStringArray("username", usernam);
                  bundle.putInt("length", l);
                  i.putExtras(bundle);
                  startActivity(i);
             }
  
          else
          {
              Toast.makeText(getBaseContext(),"INVALID USERNAME OR PASSWORD", Toast.LENGTH_LONG).show();
  
          }
                  }catch(Exception e)
                  {
  
                  }}
  
              }
          });
          b2.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View arg0) {
                  // TODO Auto-generated method stub
                   Intent i=new Intent(Welcome.this,MainActivity.class);
                      startActivity(i);
              }
          });
  
      }
  
  }
  </code></pre>
  
  <p>//view_stud.java</p>
  
  <p>package com.example.eleave;</p>
  
  <pre><code>import android.app.Activity;
  import android.app.ListActivity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.ArrayAdapter;
  import android.widget.ListView;
  import android.widget.Toast;
  import android.widget.AdapterView.OnItemClickListener;
  
  public class View_Stud extends Activity{
  
  
  
      String[] phno,reason,sem,fdate,tdate;
      String[] uname;
      int len;
      ListView lv1;
      String str[]=new String[30];
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.view_stud);
           Bundle bundle = getIntent().getExtras();
             String phno[]= bundle.getStringArray("phoneno");
             String reason[]= bundle.getStringArray("reason");
             String sem[]=bundle.getStringArray("sem");
           String  fdate[]=bundle.getStringArray("from_date");
          String  tdate[]= bundle.getStringArray("to_date");
        String uname[]=bundle.getStringArray("username");
         int len=bundle.getInt("length");
           for(int i=0;i&lt;len;i++)
           {
               str[i]=uname[i]+sem[i];
           }
  
  
          lv1=(ListView) findViewById(R.id.listView1);
          ArrayAdapter&lt;String&gt; ad=new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_list_item_1,str);
  
          lv1.setAdapter(ad);
          lv1.setOnItemClickListener(new OnItemClickListener(){
  
              @Override
              public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2,
                      long arg3) {
                  // TODO Auto-generated method stub
  
                  Intent i=new Intent(getApplicationContext(),Approve_Stud.class);
  
  
                  i.putExtra("data2", str[arg2]);
                  startActivity(i);
  
              }
  
          });
  
      }
  }
  </code></pre>
  
  <p>//logcat error</p>
  
  <pre><code>04-22 16:34:37.420: E/AndroidRuntime(4439): FATAL EXCEPTION: main
  04-22 16:34:37.420: E/AndroidRuntime(4439): java.lang.NullPointerException
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:355)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.widget.ArrayAdapter.getView(ArrayAdapter.java:323)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.widget.AbsListView.obtainView(AbsListView.java:1409)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.widget.ListView.measureHeightOfChildren(ListView.java:1216)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.widget.ListView.onMeasure(ListView.java:1127)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.view.View.measure(View.java:8314)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.widget.LinearLayout.measureVertical(LinearLayout.java:386)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.view.View.measure(View.java:8314)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.view.View.measure(View.java:8314)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.widget.LinearLayout.measureVertical(LinearLayout.java:531)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.view.View.measure(View.java:8314)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.view.View.measure(View.java:8314)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.view.ViewRoot.performTraversals(ViewRoot.java:843)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1866)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.os.Handler.dispatchMessage(Handler.java:99)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.os.Looper.loop(Looper.java:130)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at android.app.ActivityThread.main(ActivityThread.java:3683)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at java.lang.reflect.Method.invokeNative(Native Method)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at java.lang.reflect.Method.invoke(Method.java:507)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:638)
  04-22 16:34:37.420: E/AndroidRuntime(4439):     at dalvik.system.NativeStart.main(Native Method)
  </code></pre>