package com.example.administrator.mytest;import android.os.AsyncTask;import android.support.v7.app.AppCompatActivity;import android.os.Bundle;import android.util.Log;import android.view.KeyEvent;import android.view.MotionEvent;import android.view.View;import android.view.ViewGroup;import android.view.animation.TranslateAnimation;import android.widget.Button;import android.widget.TextView;public class Main9Activity extends AppCompatActivity { private Button mBt1,mBt2; private ViewGroup viewGroup; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main9); mBt1= (Button) findViewById(R.id.bt_1); mBt2= (Button) findViewById(R.id.bt_2); TranslateAnimation animation=new TranslateAnimation(0,150,0,0); animation.setRepeatCount(30); animation.setDuration(2000); mBt1.setAnimation(animation); mBt2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { new DownloadTask().execute(); } }); }private class DownloadTask extends AsyncTask{ @Override protected Integer doInBackground(String... params) { try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } int sum=10; return sum; } protected void onPostExecute(Integer sum){ mBt2.setText(""+sum); }}}