return View by coordinate - Android User Interface

Android examples for User Interface:View Find

Description

return View by coordinate

Demo Code


//package com.java2s;
import java.util.ArrayList;

import android.util.Log;

import android.view.View;
import android.view.ViewGroup;

public class Main {
    private static View returnView(ViewGroup v, ArrayList<Integer> ns) {
        ViewGroup parent = v;/*from   www. j av  a  2s .  co m*/
        for (int i = 0; i < ns.size(); i++) {
            View child = parent.getChildAt(ns.get(i));
            try {
                parent = (ViewGroup) child;
            } catch (ClassCastException e) {
                Log.d("com.ueta.tests", "child view:" + parent.getId());
                return child;
            }
        }

        Log.d("com.ueta.tests",
                "parent view:" + parent.getClass() + parent.getId());
        return parent;
    }
}

Related Tutorials