Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6328545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:28:36+00:00 2026-05-24T17:28:36+00:00

I replace multiple image in imageview at particular time(2second).image are stay in drawable folder.and

  • 0

I replace multiple image in imageview at particular time(2second).image are stay in drawable folder.and application are in 1.5.
now i would like destroy previous image while display second.so can free memory easily.
any one help me?

Thanks
nik

update ::

package com.TouchSigns;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Typeface;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class tranning extends Activity {
    /** Called when the activity is first created. */
    CountDownTimer tns_DCounter;
    Bitmap bm;
    ImageButton tran_btn_skip;
    TextView tran_banner;

    Intent tranningIntent, tranningIntent2;
    ImageView tran_imgwv_anim_image, tran_imgwv_playnow;
    private MediaPlayer xmPlayer2, xmPlayer3, xmPlayer4, xmPlayer5, xmPlayer6,
            xmPlayer7,xmPlayer8,xmPlayer9,xmPlayer10,xmPlayer11;
    CountDownTimer aCounter, aCounter2, aCounter3, aCounter4, aCounter5,
            aCounter6, aCounter7,aCounter8,aCounter9,aCounter10,aCounter11;
    Boolean flag = false;
    Typeface face;
    TouchSigns shaneshAv = new TouchSigns();

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.tranning);
        {
            try
            {
                tran_banner = (TextView) findViewById(R.id.tran_banner);

                tran_btn_skip = (ImageButton) findViewById(R.id.tran_btn_skip);

                tran_imgwv_playnow = (ImageView) findViewById(R.id.tran_imgwv_playnow);
                tran_imgwv_anim_image = (ImageView) findViewById(R.id.tran_imgwv_anim_image);
                xmPlayer2 = MediaPlayer.create(this, R.raw.bike_route);
                xmPlayer3 = MediaPlayer.create(this, R.raw.closed);
                xmPlayer4 = MediaPlayer.create(this, R.raw.exit);
                xmPlayer5 = MediaPlayer.create(this, R.raw.no_parking);
                xmPlayer6 = MediaPlayer.create(this, R.raw.one_way);
                xmPlayer7 = MediaPlayer.create(this, R.raw.phone);
                xmPlayer8 = MediaPlayer.create(this, R.raw.rail_road_crossing);
                xmPlayer9 = MediaPlayer.create(this, R.raw.sale);
                xmPlayer10 = MediaPlayer.create(this, R.raw.stop);
                xmPlayer11 = MediaPlayer.create(this, R.raw.turn_off_tap);




                tranningIntent = new Intent(this, touch_and_show.class);
                animmation();
                /*tran_btn_exit.setOnClickListener(new View.OnClickListener() {
                    public void onClick(View v) {
                        System.exit(0);
                    }
                });*/
                tran_btn_skip.setOnClickListener(new View.OnClickListener() {
                    public void onClick(View v) {
                        try
                        {
                        flag = true;
                        /*xmPlayer2.stop();
                        xmPlayer3.stop();
                        xmPlayer4.stop();
                        xmPlayer5.stop();
                        xmPlayer6.stop();
                        xmPlayer7.stop();
                        xmPlayer8.stop();
                        xmPlayer9.stop();
                        xmPlayer10.stop();
                        xmPlayer11.stop();*/


                        startActivity(tranningIntent);
                        tranningIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
                        finish();
                        }catch (Exception e) {

                        }
                    }
                });

                System.out.println(flag);


                    face = Typeface.createFromAsset(this.getAssets(),
                            "fonts/comic.TTF");








            }catch (Exception e) {

            }
        }

    }

    public void animmation() {
            try
            {

        if(flag==true)
        {   
            try
            {
            xmPlayer2.stop();
            xmPlayer3.stop();
            xmPlayer4.stop();
            xmPlayer5.stop();
            xmPlayer6.stop();
            xmPlayer7.stop();
            xmPlayer8.stop();
            xmPlayer9.stop();
            xmPlayer10.stop();
            xmPlayer11.stop();

            aCounter10.cancel();
            aCounter2.cancel();
            aCounter3.cancel();
            aCounter4.cancel();
            aCounter5.cancel();
            aCounter6.cancel();
            aCounter7.cancel();
            aCounter8.cancel();
            aCounter9.cancel();
            aCounter11.cancel();
            }catch (Exception e) {

            }
        }
        else
        {


        aCounter = new CountDownTimer(2000, 1000) {
            public void onTick(long millisUntilFinished) {
                xmPlayer2.start();
                tran_banner.setTypeface(face, Typeface.BOLD);
                tran_banner.setText("Route Sign");
                //tran_imgwv_anim_image.setImageResource(R.drawable.sm_bike_route);
                 bm = BitmapFactory.decodeResource(getResources(),R.drawable.sm_bike_route);
                tran_imgwv_anim_image.setImageBitmap(bm);
            }

            public void onFinish() {
                if(flag==true)
                {   try{
                    xmPlayer2.stop();
                    xmPlayer3.stop();
                    xmPlayer4.stop();
                    xmPlayer5.stop();
                    xmPlayer6.stop();
                    xmPlayer7.stop();
                    xmPlayer8.stop();
                    xmPlayer9.stop();
                    xmPlayer10.stop();
                    xmPlayer11.stop();



                    aCounter10.cancel();
                    aCounter2.cancel();
                    aCounter3.cancel();
                    aCounter4.cancel();
                    aCounter5.cancel();
                    aCounter6.cancel();
                    aCounter7.cancel();
                    aCounter8.cancel();
                    aCounter9.cancel();
                    aCounter11.cancel();
                }
                catch (Exception e) {

                }
                }
                else
                {
                aCounter2 = new CountDownTimer(2000, 1000) {
                    public void onTick(long millisUntilFinished) {
                        try
                        {
                        xmPlayer2.release();
                        xmPlayer3.start();
                        tran_banner.setTypeface(face, Typeface.BOLD);
                        tran_banner.setText("Closed Sign");
                        //tran_imgwv_anim_image.setImageResource(R.drawable.sm_closed);
                        bm.recycle();
                         bm = BitmapFactory.decodeResource(getResources(),R.drawable.sm_closed);
                        tran_imgwv_anim_image.setImageBitmap(bm);
                        }catch (Exception e) {
                            // TODO: handle exception
                        }
                        }
                    public void onFinish() {
                        if(flag==true)
                        {   
                            try
                            {

                            xmPlayer3.stop();
                            xmPlayer4.stop();
                            xmPlayer5.stop();
                            xmPlayer6.stop();
                            xmPlayer7.stop();
                            xmPlayer8.stop();
                            xmPlayer9.stop();
                            xmPlayer10.stop();
                            xmPlayer11.stop();


                            aCounter.cancel();
                            aCounter10.cancel();

                            aCounter3.cancel();
                            aCounter4.cancel();
                            aCounter5.cancel();
                            aCounter6.cancel();
                            aCounter7.cancel();
                            aCounter8.cancel();
                            aCounter9.cancel();
                            aCounter11.cancel();
                            }
                            catch (Exception e) {

                            }
                        }
                        else
                        {
                        aCounter3 = new CountDownTimer(2000, 1000) {
                            public void onTick(long millisUntilFinished) {
                                try
                                {
                                xmPlayer3.release();
                                xmPlayer4.start();
                                tran_banner.setTypeface(face, Typeface.BOLD);
                                tran_banner.setText("Exit Sign");

                                //tran_imgwv_anim_image.setImageResource(R.drawable.sm_exit);
                                bm.recycle();
                                bm = BitmapFactory.decodeResource(getResources(),R.drawable.sm_exit);
                                tran_imgwv_anim_image.setImageBitmap(bm);
                                }catch (Exception e) {

                                }
                                }
                            public void onFinish() {
                                if(flag==true)
                                {   
                                    try{


                                    xmPlayer4.stop();
                                    xmPlayer5.stop();
                                    xmPlayer6.stop();
                                    xmPlayer7.stop();
                                    xmPlayer8.stop();
                                    xmPlayer9.stop();
                                    xmPlayer10.stop();
                                    xmPlayer11.stop();


                                    aCounter.cancel();
                                    aCounter10.cancel();
                                    aCounter2.cancel();

                                    aCounter4.cancel();
                                    aCounter5.cancel();
                                    aCounter6.cancel();
                                    aCounter7.cancel();
                                    aCounter8.cancel();
                                    aCounter9.cancel();
                                    aCounter11.cancel();
                                    }
                                    catch (Exception e) {

                                    }
                                }
                                else
                                {
                                aCounter4 = new CountDownTimer(2000, 1000) {
                                    public void onTick(long millisUntilFinished) {
                                        try
                                        {
                                        xmPlayer4.release();
                                        xmPlayer5.start();
                                        tran_banner.setTypeface(face, Typeface.BOLD);
                                        tran_banner.setText("No Parking Sign");

                                        //tran_imgwv_anim_image.setImageResource(R.drawable.sm_no_parking);
                                        bm.recycle();
                                        bm = BitmapFactory.decodeResource(getResources(),R.drawable.sm_no_parking);
                                        tran_imgwv_anim_image.setImageBitmap(bm);
                                        }catch (Exception e) {

                                        }
                                        }
                                    public void onFinish() {
                                        if(flag==true)
                                        {   
                                            try
                                            {

                                            xmPlayer5.stop();
                                            xmPlayer6.stop();
                                            xmPlayer7.stop();
                                            xmPlayer8.stop();
                                            xmPlayer9.stop();
                                            xmPlayer10.stop();
                                            xmPlayer11.stop();


                                            aCounter.cancel();
                                            aCounter10.cancel();
                                            aCounter2.cancel();
                                            aCounter3.cancel();

                                            aCounter5.cancel();
                                            aCounter6.cancel();
                                            aCounter7.cancel();
                                            aCounter8.cancel();
                                            aCounter9.cancel();
                                            aCounter11.cancel();
                                            }
                                            catch (Exception e) {

                                            }
                                        }
                                        else
                                        {
                                        aCounter5 = new CountDownTimer(2000, 1000) {
                                            public void onTick(long millisUntilFinished) {
                                                try
                                                {
                                                xmPlayer5.release();
                                                xmPlayer6.start();
                                                tran_banner.setTypeface(face, Typeface.BOLD);
                                                tran_banner.setText("One Way Sign");

                                                //tran_imgwv_anim_image.setImageResource(R.drawable.sm_oneway);
                                                bm.recycle();
                                                bm = BitmapFactory.decodeResource(getResources(),R.drawable.sm_oneway);
                                                tran_imgwv_anim_image.setImageBitmap(bm);
                                                }catch (Exception e) {
                                                    // TODO: handle exception
                                                }

                                                }
                                            public void onFinish() {
                                                if(flag==true)
                                                {   
                                                    try
                                                    {

                                                    xmPlayer6.stop();
                                                    xmPlayer7.stop();
                                                    xmPlayer8.stop();
                                                    xmPlayer9.stop();
                                                    xmPlayer10.stop();
                                                    xmPlayer11.stop();


                                                    aCounter.cancel();
                                                    aCounter10.cancel();
                                                    aCounter2.cancel();
                                                    aCounter3.cancel();
                                                    aCounter4.cancel();

                                                    aCounter6.cancel();
                                                    aCounter7.cancel();
                                                    aCounter8.cancel();
                                                    aCounter9.cancel();
                                                    aCounter11.cancel();
                                                    }
                                                    catch (Exception e) {

                                                    }
                                                }
                                                else
                                                {
                                                aCounter6 = new CountDownTimer(2000, 1000) {
                                                    public void onTick(long millisUntilFinished) {
                                                        try
                                                        {
                                                        xmPlayer6.release();
                                                        xmPlayer7.start();
                                                        tran_banner.setTypeface(face, Typeface.BOLD);
                                                        tran_banner.setText("Phone Sign");

                                                        //tran_imgwv_anim_image.setImageResource(R.drawable.sm_phone);
                                                        bm.recycle();
                                                        bm = BitmapFactory.decodeResource(getResources(),R.drawable.sm_phone);
                                                        tran_imgwv_anim_image.setImageBitmap(bm);
                                                        }catch (Exception e) {
                                                            // TODO: handle exception
                                                        }
                                                        }
                                                    public void onFinish() {
                                                        if(flag==true)
                                                        {   
                                                            try
                                                            {

                                                            xmPlayer6.stop();
                                                            xmPlayer7.stop();
                                                            xmPlayer8.stop();
                                                            xmPlayer9.stop();
                                                            xmPlayer10.stop();
                                                            xmPlayer11.stop();


                                                            aCounter.cancel();
                                                            aCounter10.cancel();
                                                            aCounter2.cancel();
                                                            aCounter3.cancel();
                                                            aCounter4.cancel();
                                                            aCounter5.cancel();

                                                            aCounter7.cancel();
                                                            aCounter8.cancel();
                                                            aCounter9.cancel();
                                                            aCounter11.cancel();
                                                            }
                                                            catch (Exception e) {

                                                            }
                                                        }
                                                        else
                                                        {
                                                        aCounter7 = new CountDownTimer(2000, 1000) {
                                                            public void onTick(long millisUntilFinished) {
                                                                try
                                                                {
                                                                xmPlayer7.release();
                                                                xmPlayer8.start();
                                                                tran_banner.setTypeface(face, Typeface.BOLD);
                                                                tran_banner.setText("Rail Crossing Sign");
                                                                //tran_imgwv_anim_image.setImageResource(R.drawable.sm_rail_crossing);
                                                                bm.recycle();
                                                                bm = BitmapFactory.decodeResource(getResources(),R.drawable.sm_rail_crossing);
                                                                tran_imgwv_anim_image.setImageBitmap(bm);
                                                                }catch (Exception e) {
                                                                    // TODO: handle exception
                                                                }
                                                                }
                                                            public void onFinish() {
                                                                if(flag==true)
                                                                {   
                                                                    try
                                                                    {
                                                                    xmPlayer2.stop();
                                                                    xmPlayer3.stop();
                                                                    xmPlayer4.stop();
                                                                    xmPlayer5.stop();
                                                                    xmPlayer6.stop();
                                                                    xmPlayer7.stop();
                                                                    xmPlayer8.stop();
                                                                    xmPlayer9.stop();
                                                                    xmPlayer10.stop();
                                                                    xmPlayer11.stop();


                                                                    aCounter.cancel();
                                                                    aCounter10.cancel();
                                                                    aCounter2.cancel();
                                                                    aCounter3.cancel();
                                                                    aCounter4.cancel();
                                                                    aCounter5.cancel();
                                                                    aCounter6.cancel();

                                                                    aCounter8.cancel();
                                                                    aCounter9.cancel();
                                                                    aCounter11.cancel();
                                                                    }
                                                                    catch (Exception e) {

                                                                    }
                                                                }
                                                                else
                                                                {
                                                                aCounter8 = new CountDownTimer(2000, 1000) {
                                                                    public void onTick(long millisUntilFinished) {
                                                                        try
                                                                        {
                                                                        xmPlayer8.release();
                                                                        xmPlayer9.start();
                                                                        tran_banner.setTypeface(face, Typeface.BOLD);
                                                                        tran_banner.setText("Sale Sign");
                                                                        //tran_imgwv_anim_image.setImageResource(R.drawable.sm_sale);
                                                                        bm.recycle();
                                                                        bm = BitmapFactory.decodeResource(getResources(),R.drawable.sm_sale);
                                                                        tran_imgwv_anim_image.setImageBitmap(bm);
                                                                        }catch (Exception e) {

                                                                        }
                                                                        }
                                                                    public void onFinish() {
                                                                        if(flag==true)
                                                                        {
                                                                            try
                                                                            {
                                                                            xmPlayer2.stop();
                                                                            xmPlayer3.stop();
                                                                            xmPlayer4.stop();
                                                                            xmPlayer5.stop();
                                                                            xmPlayer6.stop();
                                                                            xmPlayer7.stop();
                                                                            xmPlayer8.stop();
                                                                            xmPlayer9.stop();
                                                                            xmPlayer10.stop();
                                                                            xmPlayer11.stop();


                                                                            aCounter.cancel();
                                                                            aCounter10.cancel();
                                                                            aCounter2.cancel();
                                                                            aCounter3.cancel();
                                                                            aCounter4.cancel();
                                                                            aCounter5.cancel();
                                                                            aCounter6.cancel();
                                                                            aCounter7.cancel();

                                                                            aCounter9.cancel();
                                                                            aCounter11.cancel();
                                                                            }
                                                                            catch (Exception e) {
                                                                                // TODO: handle exception
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                        aCounter9 = new CountDownTimer(2000, 1000) {
                                                                            public void onTick(long millisUntilFinished) {
                                                                                try
                                                                                {
                                                                                xmPlayer9.release();
                                                                                xmPlayer10.start();
                                                                                tran_banner.setTypeface(face, Typeface.BOLD);
                                                                                tran_banner.setText("Stop Sign");

                                                                                //tran_imgwv_anim_image.setImageResource(R.drawable.sm_stop);
                                                                                bm.recycle();
                                                                                bm = BitmapFactory.decodeResource(getResources(),R.drawable.sm_stop);
                                                                                tran_imgwv_anim_image.setImageBitmap(bm);
                                                                                }catch (Exception e) {
                                                                                    // TODO: handle exception
                                                                                }
                                                                                }
                                                                            public void onFinish() {
                                                                                if(flag==true)
                                                                                {   
                                                                                    try
                                                                                    {
                                                                                    xmPlayer2.stop();
                                                                                    xmPlayer3.stop();
                                                                                    xmPlayer4.stop();
                                                                                    xmPlayer5.stop();
                                                                                    xmPlayer6.stop();
                                                                                    xmPlayer7.stop();
                                                                                    xmPlayer8.stop();
                                                                                    xmPlayer9.stop();
                                                                                    xmPlayer10.stop();
                                                                                    xmPlayer11.stop();


                                                                                    aCounter.cancel();
                                                                                    aCounter10.cancel();
                                                                                    aCounter2.cancel();
                                                                                    aCounter3.cancel();
                                                                                    aCounter4.cancel();
                                                                                    aCounter5.cancel();
                                                                                    aCounter6.cancel();
                                                                                    aCounter7.cancel();
                                                                                    aCounter8.cancel();

                                                                                    aCounter11.cancel();
                                                                                    }
                                                                                    catch (Exception e) {

                                                                                    }
                                                                                }
                                                                                else
                                                                                {
                                                                                aCounter10 = new CountDownTimer(2000, 1000) {
                                                                                    public void onTick(long millisUntilFinished) {
                                                                                        try
                                                                                        {
                                                                                        xmPlayer10.release();
                                                                                        xmPlayer11.start();
                                                                                        tran_banner.setTypeface(face, Typeface.BOLD);
                                                                                        tran_banner.setText("Turn off Tap Sign");

                                                                                        //tran_imgwv_anim_image.setImageResource(R.drawable.sm_turn_off);
                                                                                        bm.recycle();
                                                                                        bm = BitmapFactory.decodeResource(getResources(),R.drawable.sm_turn_off);
                                                                                        tran_imgwv_anim_image.setImageBitmap(bm);
                                                                                        }catch (Exception e) {
                                                                                        }
                                                                                        }
                                                                                    public void onFinish() {

                                                                                        aCounter11 = new CountDownTimer(2000, 1000) {
                                                                                            public void onTick(long millisUntilFinished) {

                                                                                                invisibleControl();
                                                                                            }
                                                                                            public void onFinish() {
                                                                                                try {
                                                                                                /*xmPlayer2
                                                                                                .stop();
                                                                                        xmPlayer3
                                                                                                .stop();
                                                                                        xmPlayer4
                                                                                                .stop();
                                                                                        xmPlayer5
                                                                                                .stop();
                                                                                        xmPlayer6
                                                                                                .stop();
                                                                                        xmPlayer7
                                                                                                .stop();*/


                                                                                            aCounter.cancel();
                                                                                            aCounter2
                                                                                                    .cancel();
                                                                                            aCounter3
                                                                                                    .cancel();
                                                                                            aCounter4
                                                                                                    .cancel();
                                                                                            aCounter5
                                                                                                    .cancel();
                                                                                            aCounter6
                                                                                                    .cancel();


                                                                                                startActivity(tranningIntent);
                                                                                                finish();
                                                                                        }catch (Exception e) {

                                                                                        }
                                                                                            }}; aCounter11.start();
                                                                                    }
                                                                                }; aCounter10.start();
                                                                                }//else
                                                                            }
                                                                        }; aCounter9.start();
                                                                        }//else
                                                                    }
                                                                }; aCounter8.start();
                                                                }//else
                                                            }
                                                        }; aCounter7.start();
                                                        }//else
                                                    }
                                                }; aCounter6.start();
                                                }//else
                                            }
                                        }; aCounter5.start();
                                        }//else
                                    }
                                }; aCounter4.start();
                                }//else
                                }
                        }; aCounter3.start();



                        }//else
                    }
                    };
                    aCounter2.start();

                }//second else 
            }}; aCounter.start();   

            }

            }catch (Exception e) {

            }
    }


    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if ((keyCode == KeyEvent.KEYCODE_BACK)) {
            try
            {       flag=true;
                stopService(new Intent(this, backServices.class));



            finish();
            }catch (Exception e) {

            }
        }
        return super.onKeyDown(keyCode, event);
    }
     @Override
     protected void onDestroy() {
         super.onDestroy();
 try
 {
            xmPlayer2.release();
            xmPlayer3.release();
            xmPlayer4.release();
            xmPlayer5.release();
            xmPlayer6.release();
            xmPlayer7.release();
            xmPlayer8.release();
            xmPlayer9.release();
            xmPlayer10.release();
            xmPlayer11.release();
            System.gc();

 }catch (Exception e) {

 } 
 }
    private void invisibleControl() {

        RelativeLayout r;
        LinearLayout trans_linearll;
        trans_linearll = (LinearLayout) findViewById(R.id.trans_linearll);
        r = (RelativeLayout) findViewById(R.id.rela_tranning);
        r.setBackgroundResource(R.drawable.playnow);

        tran_btn_skip.setVisibility(View.INVISIBLE);
        trans_linearll.setVisibility(View.INVISIBLE);
        tran_banner.setVisibility(View.INVISIBLE);

        tran_imgwv_anim_image.setVisibility(View.INVISIBLE);
    /*  tran_imgwv_playnow.setVisibility(View.VISIBLE);*/


    }


}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T17:28:37+00:00Added an answer on May 24, 2026 at 5:28 pm

    Java has garbage collector. Objects will be deleted automatically when you no longer use them. You don’t need to do anything.

    However if you want to speed this up, then have a look at:
    Bitmap.recycle()

    http://developer.android.com/reference/android/graphics/Bitmap.html#recycle%28%29

    Bitmap myBitmap1 = BitmapFactory.decodeResource(getResources(), R.drawable.myImage1);
    imageView.setImageBitmap(myBitmap1);
    /* ... */
    Bitmap myBitmap2 = BitmapFactory.decodeResource(getResources(), R.drawable.myImage2);
    imageView.setImageBitmap(myBitmap2);
    myBitmap1.recycle(); // Don't need myBitmap1 anymore
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to tint an image with a color reference. The results should
I have a site where I would like to let users select multiple images
Suppose I have a string like this: abc%\%%%% I want to replace multiple %%%
How can I replace multiple spaces in a string with only one space in
I am trying to replace multiple rows in an Access database to follow a
I'm trying to replace multiple spaces with a single space. When I use ereg_replace
I am looking for a tool to replace multiple lines through out a project.
This is based on a similar question How to Replace Multiple Characters in Access
How to replace different/multiple chars with white space for each instance of character? characters
I'm trying to use the freeware Multiple Find And Replace 1.00 suggested in this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.