title: Is there a way to change android.R.layout.simple_list_item_1, to my custom layout?
body: <p>part of the code</p>
  
  <pre><code>        package com.example.pass;
  
   import java.text.SimpleDateFormat;
   import java.util.ArrayList;
   import java.util.Calendar;
  
  import android.app.Activity;
  import android.app.DatePickerDialog;
  import android.app.DatePickerDialog.OnDateSetListener;
  import android.app.Dialog;
  import android.app.TimePickerDialog;
  import android.app.TimePickerDialog.OnTimeSetListener;
  import android.content.Context;
  import android.database.Cursor;
  import android.database.sqlite.SQLiteDatabase;
  import android.os.Bundle;
  import android.support.v7.app.ActionBarActivity;
  import android.text.format.DateFormat;
  import android.util.Log;
  import android.view.KeyEvent;
  import android.view.LayoutInflater;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.view.View.OnKeyListener;
  import android.view.ViewGroup;
  import android.widget.AdapterView;
  import android.widget.AdapterView.OnItemLongClickListener;
  import android.widget.ArrayAdapter;
  import android.widget.Button;
  import android.widget.CursorAdapter;
  import android.widget.DatePicker;
  import android.widget.EditText;
  import android.widget.ListView;
  import android.widget.TextView;
  import android.widget.TimePicker;
  import android.widget.Toast;
  
  
  
  
      public class Permission extends ActionBarActivity implements OnClickListener, OnKeyListener{
   EditText Date;
   EditText Time;
   EditText userName;
   EditText userSurname;
   Button btnOK;
   Button Cancel;
   EditText Name;
   String Surname;
   Button clear;
   ListView list;
   ArrayList&lt;String&gt; Items;
   ArrayAdapter&lt;String&gt; aa;
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      setContentView(R.layout.activity_permission);
      list = (ListView)findViewById(R.id.listView1);
  
  
      Items = new ArrayList&lt;String&gt;();
      aa = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1,Items);
      list.setAdapter(aa);
         // Include dialog.xml file
  
       // Set dialog title
      final Dialog dialog = new Dialog(Permission.this);
      dialog.setContentView(R.layout.dialog_permission);
      dialog.setTitle("Custom Dialog");
  
      clear = (Button)findViewById(R.id.clear);
      Button add = (Button) findViewById(R.id.add);
  
  
  
      // Create custom dialog object          
      // set values for custom dialog components - text, image and button
      userName = (EditText) dialog.findViewById(R.id.dialog_username);
      userSurname = (EditText)dialog.findViewById(R.id.dialog_usersurname);
      Time = (EditText)dialog.findViewById(R.id.dialog_time2);
      Date = (EditText)dialog.findViewById(R.id.dialog_date2);    
      btnOK = (Button) dialog.findViewById(R.id.OK);
      Cancel = (Button) dialog.findViewById(R.id.Cancel);
          btnOK.setOnClickListener(this);
          userName.setOnKeyListener(this);
  
  
      add.setOnClickListener(new View.OnClickListener() {
          public void onClick(View arg0) {
  
  
             Date.setOnClickListener(new OnClickListener() {
                  @Override
                  public void onClick(View v) {
                      // TODO Auto-generated method stub
                      //To show current date in the datepicker
                      Calendar mcurrentDate=Calendar.getInstance();
                      int mYear = mcurrentDate.get(Calendar.YEAR);
                      int mMonth = mcurrentDate.get(Calendar.MONTH);
                      int mDay = mcurrentDate.get(Calendar.DAY_OF_MONTH);
  
                      DatePickerDialog mDatePicker=new DatePickerDialog(Permission.this, new OnDateSetListener() {                  
                          public void onDateSet(DatePicker datepicker, int selectedyear, int selectedmonth, int selectedday) {
                              // TODO Auto-generated method stub                      
                              /*      Your code   to get date and time    */
                              Date.setText(selectedyear+"-"+(selectedmonth+1)+"-"+selectedday);
                          }
                      },mYear, mMonth, mDay);
                      mDatePicker.setTitle("Select date");                
                      mDatePicker.show();  }
              });
  
  
             Time.setOnClickListener(new OnClickListener() {
                 @Override
                 public void onClick(View v) {
                     // TODO Auto-generated method stub
                     //To show current date in the datepicker
  
                     Calendar mcurrentTime=Calendar.getInstance();
                     int mHour = mcurrentTime.get(Calendar.HOUR_OF_DAY);
                     int mMinute = mcurrentTime.get(Calendar.MINUTE);
  
  
                     TimePickerDialog mTimePicker=new TimePickerDialog(Permission.this, new OnTimeSetListener() {                  
                         public void onTimeSet(TimePicker timepicker, int selectedhour, int selectedminute ) {
                             // TODO Auto-generated method stub                      
                             /*      Your code   to get date and time    */
                            if (selectedminute&lt;10){
                                Time.setText(selectedhour+":"+"0"+(selectedminute)+""+"val");
                            }
                            else
                          Time.setText(selectedhour+":"+(selectedminute));
                         }
                     },mHour, mMinute, false);
                     mTimePicker.setTitle("Select date");                
                     mTimePicker.show();  }
             });
  
  
  
             Cancel.setOnClickListener(new OnClickListener() {
  
                 @Override
                 public void onClick(View v) {
                     // TODO Auto-generated method stub
                     //To show current date in the datepicker
                     dialog.dismiss();
                  }
             });
  
  
          //  OK.setOnClickListener(new OnClickListener() {
  
              /*   @Override
                 public void onClick(View v) {
                     // TODO Auto-generated method stub
                  this.addItem(this.userName.getText().toString());
                     //CONVERTING THE TEXT IN TO STRING...
  
  
                     System.out.println(Name);
                  }
             });*/
  
  
             clear.setOnClickListener(new OnClickListener() {
          public void onClick(View v) {
  
                  }
             });
  
             dialog.show();
          }
  
  
  });
  
  }       
  
  
  
  private void addItem(String item){
      if(item.length()&gt;0){
          this.Items.add(item);
          this.aa.notifyDataSetChanged();
          this.userName.setText("");
      }
  }
  
      @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.permission, menu);
      return true;
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      // Handle action bar item clicks here. The action bar will
      // automatically handle clicks on the Home/Up button, so long
      // as you specify a parent activity in AndroidManifest.xml.
      int id = item.getItemId();
      if (id == R.id.action_settings) {
          return true;
      }
      return super.onOptionsItemSelected(item);
  }
  
  
  
  
  
  @Override
  public boolean onKey(View v, int keyCode, KeyEvent event) {
      // TODO Auto-generated method stub
      if(event.getAction()==KeyEvent.ACTION_DOWN&amp;&amp;keyCode==KeyEvent.KEYCODE_DPAD_CENTER){
          this.addItem(this.userName.getText().toString());
          this.addItem(this.userSurname.getText().toString());
      }
      return false;
  }
  
  
  
  
  
  @Override
  public void onClick(View v) {
      // TODO Auto-generated method stub
      if(v == this.btnOK){
          this.addItem(this.userName.getText().toString());
          this.addItem(this.userSurname.getText().toString());
          }
      }
  
     }
  </code></pre>
  
  <p>Everytime i try to change to custom layout everything crashes,  i dont know how to do it not losing dialog window, because text i am reading from is in my custom dialog. I know that maybe creating new adapter class can solve the problem but i want to try another way.</p>