find Unused View Id - Android User Interface

Android examples for User Interface:View Find

Description

find Unused View Id

Demo Code


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

public class Main {
    private static int last = 0;

    public static int findUnusedId(View v) {
        while (v.findViewById(last++) != null)
            ;//from ww w. jav a2 s. c o m
        return last;
    }
}

Related Tutorials