Uso de gif no ImageButton

Como alternar entre uma imagem GIF animada e uma imagem estática no src do ImageButton quando alguém clica nela?

noonCreate() eu tenho isto

aButton3 = (ImageButton) findViewById(R.id.imageButton3);
SharedPreferences sharedPreferences = getSharedPreferences("NAME", Context.MODE_PRIVATE);
Boolean e = sharedPreferences.getBoolean("clicked3", false);

O seguinte é executado quando alguém clica no ImageButton

public void buttonClick2(View v) {
    SharedPreferences sharedPreferences = getSharedPreferences("NAME", Context.MODE_PRIVATE);
    Boolean d = sharedPreferences.getBoolean("clicked2", false);
    if (!d) {
        toggleSound.start();
        aButton2.setImageResource(R.drawable.on);
        sharedPreferences = getSharedPreferences("NAME", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.putBoolean("clicked2", true);
        editor.commit();
    }
    if(d){
        toggleSound.start();
        aButton2.setImageResource(R.drawable.off);
        sharedPreferences = getSharedPreferences("NAME", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor = sharedPreferences.edit();
        editor.putBoolean("clicked2", false);
        editor.commit();
    }
}

questionAnswers(1)

yourAnswerToTheQuestion