title: click back button and delay to exit activity android
body: <p>I have a program that consists of two activities. I go from first activity to the second activity. Then press the Back button,  the program has delay and shows a white screen. How do I destroy delay?
  when i click my button do this in First Activity </p>
  
  <pre><code>myHandler.postDelayed(new Runnable() {
  
                  @Override
                  public void run() {
                      Animation vanish2 =AnimationUtils.loadAnimation(MainActivity.this,R.anim.out_to_right);
                      findViewById(R.id.imageView1).startAnimation(vanish2);
                      findViewById(R.id.textView1).startAnimation(vanish2);
                      vanish2.setAnimationListener(new AnimationListener() {
  
                          @Override
                          public void onAnimationStart(Animation arg0) {
  
  
                          }
  
                          @Override
                          public void onAnimationRepeat(Animation arg0) {
                              //startActivity(new Intent(MainActivity.this,S1.class));
  
                          }
  
                          @Override
                          public void onAnimationEnd(Animation arg0) {
                              t1.setVisibility(View.INVISIBLE);
                              i1.setVisibility(View.INVISIBLE);
                              startActivity(new Intent(MainActivity.this,S1.class));
  
                              //overridePendingTransition(R.anim.fadeout, R.anim.fadein);   
                              //overridePendingTransition(R.anim.push_down_in, R.anim.push_down_out);
  
                          }
                      });
                  }
              }, 400);
  </code></pre>
  
  <p>Second Activity have nothing just i want press back button and exit from second activity</p>
  
  <p>this is my whole first activity. by the way I'm beginner in android</p>
  
  <pre><code>public class MainActivity extends Activity {
  
  private ViewFlipper viewFlipper;
  private float lastX;
  
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      //getWindow().setFlags(WindowManager.LayoutParams.FLAG_DITHER, WindowManager.LayoutParams.FLAG_DITHER);
      /*requestWindowFeature(Window.FEATURE_NO_TITLE);
      this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
      WindowManager.LayoutParams.FLAG_FULLSCREEN);*/  
      setContentView(R.layout.activity_main);
      EjadeText();
      SabteDataBase();
      viewFlipper = (ViewFlipper) findViewById(R.id.view_flipper);
      final ImageView i1 = (ImageView) findViewById(R.id.imageView1);
      final ImageView i2 = (ImageView) findViewById(R.id.imageView2);
      final ImageView i3 = (ImageView) findViewById(R.id.imageView3);
      final ImageView i4 = (ImageView) findViewById(R.id.imageView4);
      final ImageView i5 = (ImageView) findViewById(R.id.imageView5);
      final TextView t1 = (TextView) findViewById(R.id.textView1);
      final TextView t2 = (TextView) findViewById(R.id.textView2);
      final TextView t3 = (TextView) findViewById(R.id.textView3);
      final TextView t4 = (TextView) findViewById(R.id.textView4);
      final TextView t5 = (TextView) findViewById(R.id.textView5);
      int a = getResources().getConfiguration().orientation;
  
      if(a!=2)
      {
      i1.setOnClickListener(new OnClickListener() {
  
  
  
  
          @Override
          public void onClick(View arg0) {
              // TODO Auto-generated method stub
              //viewFlipper.setOutAnimation(MainActivity.this, R.anim.out_to_right);
              //viewFlipper.showNext();
              Animation vanish =AnimationUtils.loadAnimation(MainActivity.this,R.anim.out_to_right);
              findViewById(R.id.imageView5).startAnimation(vanish);
              findViewById(R.id.textView5).startAnimation(vanish);
              vanish.setAnimationListener(new AnimationListener() {
  
                  @Override
                  public void onAnimationStart(Animation arg0) {
  
  
                  }
  
                  @Override
                  public void onAnimationRepeat(Animation arg0) {
                      //startActivity(new Intent(MainActivity.this,S1.class));
  
                  }
  
                  @Override
                  public void onAnimationEnd(Animation arg0) {
                      i5.setVisibility(View.INVISIBLE);
                      t5.setVisibility(View.INVISIBLE);
  
                  }
              });
  
              Handler myHandler = new Handler();
              myHandler.postDelayed(new Runnable() {
  
                  @Override
                  public void run() {
                      Animation vanish2 =AnimationUtils.loadAnimation(MainActivity.this,R.anim.out_to_right);
                      findViewById(R.id.imageView4).startAnimation(vanish2);
                      findViewById(R.id.textView4).startAnimation(vanish2);
                      vanish2.setAnimationListener(new AnimationListener() {
  
                          @Override
                          public void onAnimationStart(Animation arg0) {
  
  
                          }
  
                          @Override
                          public void onAnimationRepeat(Animation arg0) {
                              //startActivity(new Intent(MainActivity.this,S1.class));
  
                          }
  
                          @Override
                          public void onAnimationEnd(Animation arg0) {
                              i4.setVisibility(View.INVISIBLE);
                              t4.setVisibility(View.INVISIBLE);
  
                          }
                      });
                  }
              }, 100);
  
              myHandler.postDelayed(new Runnable() {
  
                  @Override
                  public void run() {
                      Animation vanish2 =AnimationUtils.loadAnimation(MainActivity.this,R.anim.out_to_right);
                      findViewById(R.id.imageView3).startAnimation(vanish2);
                      findViewById(R.id.textView3).startAnimation(vanish2);
                      vanish2.setAnimationListener(new AnimationListener() {
  
                          @Override
                          public void onAnimationStart(Animation arg0) {
  
  
                          }
  
                          @Override
                          public void onAnimationRepeat(Animation arg0) {
                              //startActivity(new Intent(MainActivity.this,S1.class));
  
                          }
  
                          @Override
                          public void onAnimationEnd(Animation arg0) {
                              i3.setVisibility(View.INVISIBLE);
                              t3.setVisibility(View.INVISIBLE);
  
                          }
                      });
                  }
              }, 200);
              myHandler.postDelayed(new Runnable() {
  
                  @Override
                  public void run() {
                      Animation vanish2 =AnimationUtils.loadAnimation(MainActivity.this,R.anim.out_to_right);
                      findViewById(R.id.imageView2).startAnimation(vanish2);
                      findViewById(R.id.textView2).startAnimation(vanish2);
                      vanish2.setAnimationListener(new AnimationListener() {
  
                          @Override
                          public void onAnimationStart(Animation arg0) {
  
  
                          }
  
                          @Override
                          public void onAnimationRepeat(Animation arg0) {
                              //startActivity(new Intent(MainActivity.this,S1.class));
  
                          }
  
                          @Override
                          public void onAnimationEnd(Animation arg0) {
                              i2.setVisibility(View.INVISIBLE);
                              t2.setVisibility(View.INVISIBLE);
  
                          }
                      });
                  }
              }, 300);
              myHandler.postDelayed(new Runnable() {
  
                  @Override
                  public void run() {
                      Animation vanish2 =AnimationUtils.loadAnimation(MainActivity.this,R.anim.out_to_right);
                      findViewById(R.id.imageView1).startAnimation(vanish2);
                      findViewById(R.id.textView1).startAnimation(vanish2);
                      vanish2.setAnimationListener(new AnimationListener() {
  
                          @Override
                          public void onAnimationStart(Animation arg0) {
  
  
                          }
  
                          @Override
                          public void onAnimationRepeat(Animation arg0) {
                              //startActivity(new Intent(MainActivity.this,S1.class));
  
                          }
  
                          @Override
                          public void onAnimationEnd(Animation arg0) {
                              t1.setVisibility(View.INVISIBLE);
                              i1.setVisibility(View.INVISIBLE);
                              Intent i = new Intent (MainActivity.this,S1.class);
                              startActivity(i);
                              //startActivity(new Intent(MainActivity.this,S1.class));
  
                              //overridePendingTransition(R.anim.fadeout, R.anim.fadein);   
                              //overridePendingTransition(R.anim.push_down_in, R.anim.push_down_out);
  
                          }
                      });
                  }
              }, 400);
  
  
          }
  
      });
  
  
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
  
      //getMenuInflater().inflate(R.menu.main, menu);
      MenuInflater menuInflater = getMenuInflater();
      menuInflater.inflate(R.layout.menu, menu);
      return true;
  }
  
  public boolean onOptionsItemSelected(MenuItem item)
  {
  
      switch (item.getItemId())
      {
      case R.id.menu_exit:
          // Single menu item is selected do something
          // Ex: launching new activity/screen or show alert message
          finish();
          return true;
  
      default:
          return super.onOptionsItemSelected(item);
      }
  }    
  
  
  ////////baraye neveshtane file bayad dar manifest e barname ejaze dad khte 4
  public void EjadeText()
  {
      File sdcard = Environment.getExternalStorageDirectory();
      File myFile = new File(sdcard,"Mas.txt"); //sabt file to sdcard
  
      /////////eijade file txt Masirha
      try
      {
          String[] valueS1 = new String[] { "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392",
                  "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392", "1  -  2  -  3  -  عباس آباد  -  11/02/1392", "4  -  5  -  6  -  سعادت آباد  -  22/03/1392"};
  
          myFile.createNewFile();
          FileOutputStream fOut = new FileOutputStream(myFile);
          OutputStreamWriter myOutWriter =new OutputStreamWriter(fOut);
  
  
          for (int i=0; i&lt;valueS1.length; i++)
          {
              myOutWriter.append(valueS1[i]);
              myOutWriter.append(";\n");
          }
  
          myOutWriter.close();
          fOut.close();
      }
      catch(IOException e)
      {
  
      }
  
      /////////eijade file txt Masirha ta inja*/
  
  
  
      /////////eijade file txt Moshtari
      File myFile1 = new File(sdcard,"Mosh.txt"); //sabt file to sdcard
      try
      {
          String[] valueS1 = new String[] { "1 - علی احمدی - خ شيخ مفيد ک سعدي - 7896541;10,000,000;20,000,000;0;2000;علی احمدی;1;",
                  "2 - علی احمدپور - خ شيخ مفيد ک سعدي - 7896541;1,000;2;0;2;علی احمدپور;2;",
                  "3 - علی احمدپور - خ شيخ مفيد ک سعدي - 7896541;10787800;20,45500;0;20450;علی احمدپور;3;",
                  "4 - اصغر اصغری - خ شيخ صدوق ک علامه - 9875236;123456;654321;1478523;0;اصغر اصغری;4;",
                  "5 - علی احمدی - خ شيخ مفيد ک سعدي - 7896541;10,000,000;20,000,000;0;2000;علی احمدی;5;",
                  "6 - اصغر اصغری - خ شيخ صدوق ک علامه - 9875236;123456;654321;1478523;0;اصغر اصغری;6;"};
          myFile1.createNewFile();
          FileOutputStream fOut = new FileOutputStream(myFile1);
          OutputStreamWriter myOutWriter =new OutputStreamWriter(fOut);
          for (int i=0; i&lt;valueS1.length; i++)
          {
              myOutWriter.append(valueS1[i]);
              myOutWriter.append(";\n");
          }
          myOutWriter.close();
          fOut.close();
      }
      catch(IOException e)
      {
  
      }
      /////////eijade file txt Moshtari ta inja */
  
  
  
      //////// Ejade File txt Kala 
      File myFile2 = new File(sdcard,"Kala.txt"); //sabt file to sdcard
      try
      {
          String[] valueS1 = new String[] { "1 - Keyk - keyke yazdi - duneyee - basteyee - 5000 - 50;50;Keyk;1;","2 - Tanagholat - pastil - basteyee - kilooye - 20000 - 4000;4000;Tanagholat;2;",
                  "3 - Keyk - keyke yazdi - duneyee - basteyee - 5000 - 50;50;Keyk;3;","4 - Tanagholat - pastil - basteyee - kilooye - 20000 - 4000;4000;Tanagholat;4;"};
          myFile2.createNewFile();
          FileOutputStream fOut = new FileOutputStream(myFile2);
          OutputStreamWriter myOutWriter =new OutputStreamWriter(fOut);
          for (int i=0; i&lt;valueS1.length; i++)
          {
              myOutWriter.append(valueS1[i]);
              myOutWriter.append(";\n");
          }
          myOutWriter.close();
          fOut.close();
      }
      catch(IOException e)
      {
  
      }
  
  
      File myFile3 = new File(sdcard,"KalaGorooh.txt"); //sabt file to sdcard
      try
      {
          String[] valueS1 = new String[] { "Keyk;","Tanagholat;"};
          myFile3.createNewFile();
          FileOutputStream fOut1 = new FileOutputStream(myFile3);
          OutputStreamWriter myOutWriter1 =new OutputStreamWriter(fOut1);
          for (int i=0; i&lt;valueS1.length; i++)
          {
              myOutWriter1.append(valueS1[i]);
              myOutWriter1.append("\n");
          }
          myOutWriter1.close();
          fOut1.close();
      }
      catch(IOException e)
      {
  
      }
      ////// Ejade File txt Kala tainja*/ 
  
  }
  
  public void SabteDataBase()
  {
      final android.database.sqlite.SQLiteDatabase  myDB= this.openOrCreateDatabase("DB_Bazaryab", MODE_PRIVATE, null);
      /////////  Ejade DB va Table 
      ////////   khundane file text baraye masirha va Ejade Table
      try 
      {
  
          File sdcard = Environment.getExternalStorageDirectory();
          File file = new File(sdcard,"Mas.txt");
          StringBuilder text = new StringBuilder();
          BufferedReader br = new BufferedReader(new FileReader(file));
          String line;
          while ((line = br.readLine()) != null) {
              text.append(line);
          }
          String TableName = "Tbl_Masir";
          String[] valueS = text.toString().split(";");
          myDB.execSQL("DROP TABLE IF EXISTS Tbl_Masir");
       // "IF NOT EXIT" ro baraye test bardashtam
          myDB.execSQL("CREATE TABLE Tbl_Masir (id int, Address VARCHAR);");
          for (int i=0; i&lt;valueS.length; i++)
          {
  
          myDB.execSQL("INSERT INTO "
                   + TableName
                   + " (id, Address)"
                   + " VALUES ("+ Integer.toString(i)+",'"+valueS[i] + "');");
          }
  
      }
      catch(IOException e)
      {
  
      }
      ////////khundane file text baraye masirha va Ejade Table ta inja */
  
  
  
       ////////khundane file text baraye Moshtari va Ejade Table
      try 
      {
          File sdcard = Environment.getExternalStorageDirectory();
          File file = new File(sdcard,"Mosh.txt");
          StringBuilder text = new StringBuilder();
          BufferedReader br = new BufferedReader(new FileReader(file));
          String line;
          while ((line = br.readLine()) != null) {
              text.append(line);
          }
  
          myDB.execSQL("DROP TABLE IF EXISTS Tbl_Moshtari");
          String[] valueS = text.toString().split(";");
       // "IF NOT EXIT" ro baraye test bardashtam
          myDB.execSQL("CREATE TABLE Tbl_Moshtari (id int, Info VARCHAR,Et_Naghd VARCHAR,Et_Chek VARCHAR,Mande_Bedehi VARCHAR, Cheke_Bargashti VARCHAR,Name_Moshtari VARCHAR,Code_Moshtari VARCHAR);");
          int k=0;
          for (int i=0; i&lt;valueS.length; i=i+8)
          {
          myDB.execSQL("INSERT INTO Tbl_Moshtari (id, Info, Et_Naghd, Et_Chek ,Mande_Bedehi ,Cheke_Bargashti , Name_Moshtari, Code_Moshtari)  VALUES ("+ Integer.toString(k)+",'"+valueS[i] + "','"+ valueS[i+1]+"','"+valueS[i+2] +"','" +valueS[i+3]+"','"+valueS[i+4] +"','"+valueS[i+5] +"','"+valueS[i+6] +"');");
          k++;
          }
      }
      catch(IOException e)
      {
  
      } 
  
  
      ////////khundane file text baraye Moshtari va Ejade Table  ta inja*/ 
  
       ////////khundane file text baraye Kala va Ejade Table
      try 
      {
  
          File sdcard = Environment.getExternalStorageDirectory();
          File file = new File(sdcard,"Kala.txt");
          StringBuilder text = new StringBuilder();
          BufferedReader br = new BufferedReader(new FileReader(file));
          String line;
          while ((line = br.readLine()) != null) {
              text.append(line);
          }
          String TableName = "Tbl_Kala";
          String[] valueS = text.toString().split(";");
          myDB.execSQL("DROP TABLE IF EXISTS Tbl_Kala");
       // "IF NOT EXIT" ro baraye test bardashtam
          myDB.execSQL("CREATE TABLE Tbl_Kala (id int, Kalaha VARCHAR, Gh_Vahed VARCHAR, Name_Gorooh VARCHAR, Code_Kala VARCHAR);");
          for (int i=0; i&lt;valueS.length; i = i+5)
          {
  
          myDB.execSQL("INSERT INTO "
                   + TableName
                   + " (id, Kalaha, Gh_Vahed, Name_Gorooh, Code_Kala)"
                   + " VALUES ("+ Integer.toString(i)+",'"+valueS[i] +"','"+valueS[i+1]+"','"+valueS[i+2]+"','"+valueS[i+3]+ "');");
          }
  
      }
      catch(IOException e)
      {
  
      }
  
  
      try 
      {
  
          File sdcard = Environment.getExternalStorageDirectory();
          File file = new File(sdcard,"KalaGorooh.txt");
          StringBuilder text1 = new StringBuilder();
          BufferedReader br1 = new BufferedReader(new FileReader(file));
          String line;
          while ((line = br1.readLine()) != null) {
              text1.append(line);
          }
          String TableName = "Tbl_KalaGorooh";
          String[] valueS = text1.toString().split(";");
          myDB.execSQL("DROP TABLE IF EXISTS Tbl_KalaGorooh");
       // "IF NOT EXIT" ro baraye test bardashtam
          myDB.execSQL("CREATE TABLE Tbl_KalaGorooh (id int, Name_Gorooh VARCHAR);");
          for (int i=0; i&lt;valueS.length; i++)
          {
  
          myDB.execSQL("INSERT INTO "
                   + TableName
                   + " (id, Name_Gorooh)"
                   + " VALUES ("+ Integer.toString(i)+",'"+valueS[i] + "');");
          }
  
      }
      catch(IOException e)
      {
  
      }
  
      ////////khundane file text baraye Kala va Ejade Table ta inja */
  
  
  
  
  
  }
   public void onDestroy()
      {
          super.onDestroy();
          ArrayList&lt;Activity&gt; activities=new ArrayList&lt;Activity&gt;();
          activities.remove(this);
      }
  </code></pre>
  
  <p>}</p>