Android 单击后退按钮并延迟以退出活动

Android 单击后退按钮并延迟以退出活动,android,delay,Android,Delay,我有一个由两项活动组成的计划。我从第一个活动到第二个活动。然后按下后退按钮,程序有延迟并显示白色屏幕。我该如何销毁延迟? 当我单击我的按钮时,请在第一个活动中执行此操作 myHandler.postDelayed(new Runnable() { @Override public void run() { Animation vanish2 =AnimationUtils.loadAnima

我有一个由两项活动组成的计划。我从第一个活动到第二个活动。然后按下后退按钮,程序有延迟并显示白色屏幕。我该如何销毁延迟? 当我单击我的按钮时,请在第一个活动中执行此操作

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);
第二个活动没有任何内容,只需按“后退”按钮并退出第二个活动

这是我的第一次活动。顺便说一下,我是android的初学者

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<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<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<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<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<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<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<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<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<Activity> activities=new ArrayList<Activity>();
        activities.remove(this);
    }
公共类MainActivity扩展活动{
私有ViewFlipper ViewFlipper;
私人浮动lastX;
@凌驾
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
//getWindow().setFlags(WindowManager.LayoutParams.FLAG_抖动,WindowManager.LayoutParams.FLAG_抖动);
/*requestWindowFeature(窗口。功能\u无\u标题);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_全屏,
WindowManager.LayoutParams.FLAG_全屏);*/
setContentView(R.layout.activity_main);
EjadeText();
SabteDataBase();
viewFlipper=(viewFlipper)findViewById(R.id.view\u flipper);
最终ImageView i1=(ImageView)findViewById(R.id.imageView1);
最终ImageView i2=(ImageView)findViewById(R.id.imageView2);
最终ImageView i3=(ImageView)findViewById(R.id.imageView3);
最终ImageView i4=(ImageView)findViewById(R.id.imageView4);
最终ImageView i5=(ImageView)findViewById(R.id.imageView5);
最终文本视图t1=(文本视图)findViewById(R.id.textView1);
最终文本视图t2=(文本视图)findViewById(R.id.textView2);
最终文本视图t3=(文本视图)findViewById(R.id.textView3);
最终文本视图t4=(文本视图)findViewById(R.id.textView4);
最终文本视图t5=(文本视图)findViewById(R.id.textView5);
int a=getResources().getConfiguration().orientation;
如果(a!=2)
{
i1.setOnClickListener(新的OnClickListener(){
@凌驾
公共void onClick(视图arg0){
//TODO自动生成的方法存根
//viewFlipper.setOutAnimation(MainActivity.this,R.anim.out\u向右);
//viewFlipper.showNext();
Animation vash=AnimationUtils.loadAnimation(MainActivity.this,R.anim.out\u向右);
findViewById(R.id.imageView5)、startAnimation(消失);
findViewById(R.id.textView5)。开始动画(消失);
消失.setAnimationListener(新的AnimationListener(){
@凌驾
动画开始时的公共void(动画arg0){
}
@凌驾
AnimationRepeat上的公共无效(动画arg0){
//startActivity(新意图(MainActivity.this,S1.class));
}
@凌驾
onAnimationEnd上的公共无效(动画arg0){
i5.设置可见性(视图不可见);
t5.设置可见性(视图不可见);
}
});
Handler myHandler=newhandler();
myHandler.postDelayed(新的Runnable(){
@凌驾
公开募捐{
Animation Vansi2=AnimationUtils.loadAnimation(MainActivity.this,R.anim.out\u向右);
findViewById(R.id.imageView4)、startAnimation(消失2);
findViewById(R.id.textView4)、startAnimation(2);
消失2.setAnimationListener(新的AnimationListener(){
@凌驾
动画开始时的公共void(动画arg0){
}
@凌驾
AnimationRepeat上的公共无效(动画arg0){
//startActivity(新意图(MainActivity.this,S1.class));
}
@凌驾
onAnimationEnd上的公共无效(动画arg0){
i4.设置可见性(视图不可见);
t4.设置可见性(视图不可见);
}
});
}
}, 100);
myHandler.postDelayed(新的Runnable(){
@凌驾
公开募捐{
Animation Vansi2=AnimationUtils.loadAnimation(MainActivity.this,R.anim.out\u向右);
findViewById(R.id.imageView3)、startAnimation(2);
findViewById(R.id.textView3)、startAnimation(2);
消失2.setAnimationListener(新的AnimationListener(){
@凌驾
动画开始时的公共void(动画arg0){
}
@凌驾
AnimationRepeat上的公共无效(动画arg0){
//startActivity(新意图(MainActivity.this,S1.class));
}
@凌驾
onAnimationEnd上的公共无效(动画arg0){
i3.设置可见性(视图不可见);
t3.设置可见性(视图不可见);
}
});
}
}, 200);
myHandler.postDelayed(新的Runnable(){
@凌驾
公开募捐{
Animation Vansi2=AnimationUtils.loadAnimation(MainActivity.this,R.anim.out\u向右);
findViewById(R.id.imageView2)、startAnimation(消失2);
findViewById(R.id.textView2)、startAnimation(消失2);
消失2.setAnimationListener(新的AnimationListener(){
@凌驾
动画开始时的公共void(动画arg0){
}
@凌驾
AnimationRepeat上的公共无效(动画arg0){
//startActivity(新意图(MainActivity.this,S1.class));