Get the default android empty ListView. - Android User Interface

Android examples for User Interface:ListView

Description

Get the default android empty ListView.

Demo Code


//package com.java2s;
import android.app.Activity;
import android.view.View;

public class Main {
    /**/*from   w  w w .  j  av  a2s  . com*/
     * Get the default android empty list view.
     *
     * android.R.id.empty, defined in xml by @android:id/empty
     *
     * @param v Parent view
     * @return View
     */
    public static <V> V androidEmptyView(View v) {
        return (V) view(v, android.R.id.empty);
    }

    /**
     * Get the default android empty list view.
     *
     * android.R.id.empty, defined in xml by @android:id/empty
     *
     * @param a Parent activity
     * @return View
     */
    public static <V> V androidEmptyView(Activity a) {
        return (V) view(a, android.R.id.empty);
    }

    /**
     * Find a child view of any type.
     *
     * @param v Parent view
     * @param childId Child view id.
     * @return View
     */
    public static <V extends View> V view(View v, int childId) {
        return (V) v.findViewById(childId);
    }

    /**
     * Find a child view of any type.
     *
     * @param a Parent activity.
     * @param childId Child view id.
     * @return View
     */
    public static <V extends View> V view(Activity a, int childId) {
        return (V) a.findViewById(childId);
    }
}

Related Tutorials