MultiThreading issues while programing for android

后端 未结 4 568
名媛妹妹
名媛妹妹 2020-12-06 04:11

I am developing on Android but the question might be just as valid on any other Java platform.

I have developed a multi-threaded app. Lets say I have a first class t

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-06 04:38

    if you want use AsyncTask rather then thread in android I have resolve it using ASyncTask and Handler in Android the aim is that one task is execute after compilation of one task hear is code that show First load animation on view after compilation of that process it will goes on another page

     class gotoparent extends AsyncTask
    
    {
        @Override
        protected String doInBackground(String... params) {
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
    
    
    
                            Animation animation= AnimationUtils.loadAnimation(getApplicationContext(),R.anim.rotete);
                            lin2.startAnimation(animation);
    
    
    
    
                }
            });
    
            return null;
        }
    
        @Override
        protected void onPostExecute(String s) {
            super.onPostExecute(s);
            new Handler().postDelayed(new Runnable() {
    
                @Override
                public void run() {
                    Intent i=new Intent(getApplicationContext(),ParentsCornor.class);
                    startActivity(i);
    
                }
            }, 1200);
    
        }
    }
    

提交回复
热议问题