This will not answer your question if it is effective or does not call this method each time. But, as @ njzk2 noted, you can use the State Selector on the toggle button.
I am copying you a working example (I use). Just change the drawable name with your drawings.
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/toggle_on" android:state_checked="true" /> <item android:drawable="@drawable/toggle_off" android:state_checked="false" /> </selector>
On your xml, where you define your Google button, set the background as:
android:background="@drawable/toogle_selector"
Where "toogle_selector" is the name of the file I copied before.
With this, you can forget the download efficiency every time.
Hope this helps.
Sulfkain
source share