title: Display more than one item in array list
body: <p>Hello guys i would like to display more than one item horizontally in a single list. This items are picked from the dialog box that has two button ok and cancel. When you click okay it should pick the values from the edit text and a string value from the dialog and display in the list horizontally.</p>
  
  <pre><code>Array List Adapter
  public class VehicleListAdapter extends ArrayAdapter&lt;String&gt; {
  private Context context;
  private List&lt;String&gt; vehicle_no;
  public VehicleListAdapter(Context context, int resource, List&lt;String&gt; objects) {
      super(context, resource, objects);
      this.context = context;
      this.vehicle_no = objects;
  
  
  }
  
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
      //get the vehicle number we are displaying
      String my_vehicle = vehicle_no.get(position);
  
      //get the inflater and inflate the XML layout for each item
      LayoutInflater inflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
      View view = inflater.inflate(R.layout.vehicle_num_layout, null);
      TextView txt_vehicle_num = (TextView) view.findViewById(R.id.txt_vehicle_num);
      txt_vehicle_num.setText(my_vehicle);
      return view;
  }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>Activity with the list
  button.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View arg0) {
  
              // get prompts.xml view
              LayoutInflater li = LayoutInflater.from(context);
              View promptsView = li.inflate(R.layout.prompts, null);
  
              AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
                      context);
  
              // set prompts.xml to alertdialog builder
              alertDialogBuilder.setView(promptsView);
  
              final EditText userInput = (EditText) promptsView
                      .findViewById(R.id.editTextDialogUserInput);
  
              // set dialog message
              alertDialogBuilder
                      .setCancelable(false)
                      .setPositiveButton("OK",
                              new DialogInterface.OnClickListener() {
                                  public void onClick(DialogInterface dialog, int id) {
                                      // get user input and set it to result
                                      // edit text
  
                                      if(userInput.getText().toString().trim().length()==0) {
                                          userInput.setError("Vehicle Number Required");
                                          focus.start();
                                          String stime = focus.getText().toString();
  
  
                                      }
                                      else {
                                          result.setText(userInput.getText());
                                          ListView list = (ListView) findViewById(R.id.list);
                                          vehicle_list.add(userInput.getText().toString().trim());
                                          VehicleListAdapter listAdapter = new VehicleListAdapter(StartWatch.this, 0, vehicle_list);
                                          list.setAdapter(listAdapter);
                                      }
                                  }
                              })
                      .setNegativeButton("Cancel",
                              new DialogInterface.OnClickListener() {
                                  public void onClick(DialogInterface dialog, int id) {
                                      dialog.cancel();
                                  }
                              });
  
              // create alert dialog
              AlertDialog alertDialog = alertDialogBuilder.create();
  
              // show it
              alertDialog.show();
  
          }
      });
  </code></pre>