Android button is not available when playing animation

I have a button, and while this button plays the animation, I can’t click the button. I installed a listener and a touch listener, but in debug mode it is not included in OnClick and onTouch methods. You know why? Thanks

edit: I tried something like:

        AsyncTask task = new AsyncTask() {

        @Override
        protected Object doInBackground(Object... objects) {
            button1.setOnClickListener(new View.OnClickListener() {

                public void onClick(View view) {
                    Toast toast = Toast.makeText(MyActivity.this, button1.getText(), Toast.LENGTH_SHORT);
                    toast.show();
                }
            });
            return null;
        }

        ;
    };
    task.execute(button1);

but it does not work

Edit: here is the full source code

+5
source share
6 answers

Android 3.0 , - ( ) : http://android-developers.blogspot.com/2011/02/animation-in-honeycomb.html

:

  • ViewGroup, onDraw
  • onDraw . ( FrameLayout - ).
  • 3.0+
  • onTouch ( onInterceptTouchEvent), , ( , *), ... * ( , ), , .
+8

, ... setFillAfter (True), , , -, , , - , ... , setFillAfter (false), , after anmation, , , android

....

EditText stucks ......?

setFillafter (false) , , . , .

== > , , ( ), , , .

+1

. - async android, AsyncTask JavaDoc.

: , , . , , - , , .

0
I think there are two things

1) . , , , , ( , )

2) -, , . , focus.once onfoucslistener , . ?

0

async, , . , : . , click async-

0

AsyncTask. Android .

asynctask.

:

public class MyActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // Initialisation of the Activity 
        MyLongTask task = new MyLongTask();
        task.execute("http://blog.fr4gus.com/api/test.json");
    }

    @Override
    protected void onPause() {
        // If you wanna make something in the pause of the Asynctask
    }

    class MyLongTask extends AsyncTask<String, Void, Void>{

        @Override
        protected void onPreExecute() {
            // Before executing what you want to execute
        }

        @Override
        protected Void doInBackground(String... params) {
            // what you want to execute come here :D
            return null; // Or whatever you want pass to onPostExecute
        }

        @Override
        protected void onPostExecute(Void result) {
            // Here we can update for example the UI with something (who knows :? )
        }
    }

}

Asynctask, , :

 class MyLongTask extends AsyncTask<String, Void, Void>{ ...

Then, first, the doInBAckground parameter, the next onPreExecute parameter, and the last onPostExecute parameter. This way you can send parameters as buttons.

You can learn more about here or in my first link.

-1
source

All Articles