get Overflow Button Internal - Android User Interface

Android examples for User Interface:View

Description

get Overflow Button Internal

Demo Code


//package com.java2s;
import java.lang.reflect.Field;

import android.view.View;

public class Main {
    private static View getOverflowButtonInternal(Object menuPresenterView) {
        try {//from   www. j  a va 2s  .  c o  m
            Field overflowField = menuPresenterView.getClass()
                    .getDeclaredField("mOverflowButton");
            overflowField.setAccessible(true);
            View overFlowButtonView = (View) overflowField
                    .get(menuPresenterView);
            return overFlowButtonView;
        } catch (NoSuchFieldException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return null;

    }
}

Related Tutorials