title: drawable is not serializable exception
body: <p>Hello I'm new to android development.
  I try to make a list that takes 4 input fields and one photo.</p>
  
  <p>The list should be saved in the internal storage but I'm getting this error: </p>
  
  <pre><code>java.io.notserializableexception android.graphics.drawable.bitmapdrawable;
  </code></pre>
  
  <p>Person bean class has 4 string variables and one Drawable.
  Thanks for any help.</p>
  
  <pre><code>package com.example.awais_pc.savedataapp;
  
  import android.app.Dialog; import android.content.Context; import android.graphics.drawable.Drawable; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageButton; import android.widget.ListView; import android.widget.Toast;
  
  import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.ArrayList;
  
  public class MainActivity extends AppCompatActivity {
      ListView listview;
      String fileName = "data.txt";
      ArrayList&lt;PersonBean&gt; personBeans ;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      listview = (ListView)findViewById(R.id.listView);
          readDataInFile();
  
  }
  
      public void addRecord(View v ){
          myDialog();
      }
      public void myDialog(){
          final ImageButton imgbtn;
          final EditText name,pass,email,phone;
          final Dialog dialog = new Dialog(this);
          dialog.setContentView(R.layout.mydialog);
          dialog.setCancelable(false);
  
          name = (EditText)dialog.findViewById(R.id.editTextName);
           pass = (EditText)dialog.findViewById(R.id.editTextPassword);
           email = (EditText)dialog.findViewById(R.id.editTextEmail);
          phone = (EditText)dialog.findViewById(R.id.editTextPhone);
            imgbtn = (ImageButton) dialog.findViewById(R.id.imageButton);
          Button save = (Button) dialog.findViewById(R.id.buttonSubmit);
          save.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
  
                  String nam = name.getText().toString();
                  String pas = pass.getText().toString();
                  String em = email.getText().toString();
                  String ph = phone.getText().toString();
                  Drawable dra = imgbtn.getDrawable();
                  personBeans.add(new PersonBean(nam,pas,em,ph,dra));
                  listview.setAdapter(new Mycustomlist(personBeans, MainActivity.this));
  
                  dialog.dismiss();
              }
          });
          dialog.show();
      }
  
      private void writeDataInFile(){
          try {
              FileOutputStream fos = openFileOutput(fileName, Context.MODE_PRIVATE);
              ObjectOutputStream oos = new ObjectOutputStream(fos);
              oos.writeObject(personBeans);
              oos.flush();
              oos.close();
              fos.close();
          } catch (Exception e) {
              Toast.makeText(MainActivity.this, ""+e, Toast.LENGTH_SHORT).show();
              e.printStackTrace();
          }
  
          listview.setAdapter(new Mycustomlist(personBeans, MainActivity.this));
      } // Write File
  
      private void readDataInFile(){
          try {
              FileInputStream fis = openFileInput(fileName);
              ObjectInputStream ois = new ObjectInputStream(fis);
              personBeans = (ArrayList&lt;PersonBean&gt;)ois.readObject();
          } catch (Exception e) {
              personBeans = new ArrayList&lt;PersonBean&gt;();
              Toast.makeText(MainActivity.this, ""+e, Toast.LENGTH_SHORT).show();
              e.printStackTrace();
          }
          listview.setAdapter(new Mycustomlist(personBeans, MainActivity.this));
  
      }//Read File }
  </code></pre>