Example usage for android.widget ImageView setTag

List of usage examples for android.widget ImageView setTag

Introduction

In this page you can find the example usage for android.widget ImageView setTag.

Prototype

public void setTag(int key, final Object tag) 

Source Link

Document

Sets a tag associated with this view and a key.

Usage

From source file:com.androidquery.AbstractAQuery.java

/**
 * Set the image of an ImageView./*from w  w  w .jav  a  2s  .c  o m*/
 *
 * @param resid the resource id
 * @return self
 * 
 * @see testImage1
 */
public T image(int resid) {

    if (view instanceof ImageView) {
        ImageView iv = (ImageView) view;
        iv.setTag(AQuery.TAG_URL, null);
        if (resid == 0) {
            iv.setImageBitmap(null);
        } else {
            iv.setImageResource(resid);
        }
    }

    return self();
}

From source file:com.androidquery.AbstractAQuery.java

/**
 * Clear a view. Applies to ImageView, WebView, and TextView.
 *
 * @return self//from  ww w. ja  va 2  s  . c  o  m
 */
public T clear() {

    if (view != null) {

        if (view instanceof ImageView) {
            ImageView iv = ((ImageView) view);
            iv.setImageBitmap(null);
            iv.setTag(AQuery.TAG_URL, null);
        } else if (view instanceof WebView) {
            WebView wv = ((WebView) view);
            wv.stopLoading();
            wv.clearView();
            wv.setTag(AQuery.TAG_URL, null);
        } else if (view instanceof TextView) {
            TextView tv = ((TextView) view);
            tv.setText("");
        }

    }

    return self();
}