FileDocCategorySizeDatePackage
InstrumentationUtils.javaAPI DocAndroid 5.1 API1538Thu Mar 12 22:22:42 GMT 2015android.test

InstrumentationUtils

public class InstrumentationUtils extends Object
The InstrumentationUtils class has all the utility functions needed for instrumentation tests. {@hide} - Not currently used.

Fields Summary
Constructors Summary
Methods Summary
public static intgetMenuIdentifier(java.lang.Class cls, java.lang.String identifier)
An utility function that returns the menu identifier for a particular menu item.

param
cls Class object of the class that handles the menu ite,.
param
identifier Menu identifier.
return
The integer corresponding to the menu item.

        int id = -1;
        try {
            Integer field = (Integer)cls.getDeclaredField(identifier).get(cls);   
            id = field.intValue();
        } catch (NoSuchFieldException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
        return id;