5

How to delete a background image when you change images in Android

 2 years ago
source link: https://www.codesd.com/item/how-to-delete-a-background-image-when-you-change-images-in-android.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

How to delete a background image when you change images in Android

advertisements

I have a button which switches between 2 images depending on the number of clicks...sometimes I get after leaving the activity and returning, both images show. How do make sure that only 1 image is showing?

Here is the code for the swap:

public void swapImageButton() {
    swapCount ++;
    if(swapCount % 2 == 0) {
        mStomachImageButton.setBackground(getDrawable(image1));
        mFartImageButton.setBackground(getDrawable(image2));
    } else {
        mStomachImageButton.setBackground(getDrawable(image2));
        mFartImageButton.setBackground(getDrawable(image1));
    }
}


Use a static variable for count.

static int count=0;

public void swapImageButton() {

    if(count == 0) {
       //show you image when clicked first time
        count=1;
    } else {
        //show you image when clicked second time
        count=0;
    }
}

Related Articles

How to delete the background image and get the image before

there are two images alt text http://bbs.shoucangshidai.com/attachments/month_1001/1001211535bd7a644e95187acd.jpg alt text http://bbs.shoucangshidai.com/attachments/month_1001/10012115357cfe13c148d3d8da.jpg one is background image another one is a pe

how to delete the background image by using jquery with the class name

I'm trying to remove the background image using jquery.But its not happening, But using the same format i can change the background color <html> <head> <style> h1 { background-image:url('paper.gif'); background-color:#cccccc; } </styl

When you change activity in Android, how do I view a Splashscreen until the rendering of the Activity is complete?

When changing Activity in Android, loading of the contentView of the new Activity is very slow. Can I somehow hide the new Activity in the background, and show a Splashscreen until the rendering of the Activity is finished? Should I use PopupWindow a

How to delete the listview item when you click the Remove button in each list item in Android

I want to delete list item when I click delete text in each listItem. I tried different ways but nothing worked for me how to do that I have MainActivity, Custom array adapter and listview XML file. All of my list rows have a delete text view when I

How to delete decimals in SQL when you create a view

(IsNUll((CAST(MHSE_ as varchar (20))),'') + ' ' + isnull(MDIRCT,'') + ' ' + IsNull(MSTRT,'') + ' ' + isnull(MSTTYP,'')) as FULLADDRESS This is in View trying to combine multiple column in one MHSE_ column has decimal. My result now comes like: 13185.

How to stop the onCreateView call when you change different tabs (like tab1, tab2) in Android?

I have a question, a tab bar at the bottom of MainActivity (extends FragmentActivity), when I launch the app, the fragment1(in tab1) and fragment2(in tab2) will call onCreateView, and some loading operation(like scan something) in each fragent, but I

How to set the background image in Android ListView?

i want have an image and i want to set it as a background of android list view i have used android:background="drawable/image" but nothing happened can any one guide me how to achieve this? any help would be appricated.Perhops android:background

How to get a clean copy when you change a branch?

This question already has an answer here: Why doesn't Git remove some files when I switch a branch? 3 answers Let's assume I've been working in a feature branch and added a number of files there. They were successfully committed and pushed. Now I swi

Blogspot. How do I delete the background image? This is a double of my photo on my article. Help us. I am not good in html

Blogspot. How to remove the background image? Its a duplicate of my picture on my post. Pls help. I'm not good in html. phrecks.blogspot.com enter image description here .bg-photo{ background-image:none; } Use this code to remove that background imag

How to configure the background image in the browser using html

I have made a simple login page and set an image as background but it is not fitting to browser screen.I am using html for this purpose what should I do fit the image to browser screen.Kindly please describe in detail. <%@ page language="java"

How to set the background image in sencha touch 2

Im trying to put an image background to my form panel , it doesnt display anything , im using the code in this tutoriel : http://miamicoder.com/2012/adding-a-login-screen-to-a-sencha-touch-application-part-2/ here is my login view : Ext.define('MyApp

How to display the background image in the list view via json data analysis with the use of volleyball while the image is not loaded

How to show background image in list view via parsing json data with use of volley while image is not loaded .or if image url is not present in json then by default background image should be appear. in the image you can see in the list ist image url

How to put the background image in a text field and a text view on iphone?

Although I have set the background image property in UITextField. It doesn't apply.I didn't use any coding. I have just selected an image.png file as the backround image using Interface Builder. So,How to do it ? And there is no background image prop

How to add a background image to the Docx document via Apache Poi?

How i can add background image to docx document through Apache POI or other java framework. I would like have some xml block, where defined background, in result document like that <w:document xmlns:wpc="http://schemas.microsoft.com/office/word/20

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK