Example usage for android.view View NO_ID

List of usage examples for android.view View NO_ID

Introduction

In this page you can find the example usage for android.view View NO_ID.

Prototype

int NO_ID

To view the source code for android.view View NO_ID.

Click Source Link

Document

Used to mark a View that has no ID.

Usage

From source file:Main.java

public static String getIDNameFromView(View v) {
    // -- get your View --
    int id = v.getId(); // get integer id of view
    String idString = "";
    if (id != View.NO_ID) { // make sure id is valid
        Resources res = v.getResources(); // get resources
        if (res != null)
            idString = res.getResourceEntryName(id); // get id string entry
    }/*  w  ww  .j  av  a  2  s  .c o m*/
    return idString;
}

From source file:Main.java

public static String getResourceId(View v) {
    // http://stackoverflow.com/a/17583380/198348
    int id = v.getId();
    String idString = "no id";
    if (id != View.NO_ID) {
        Resources res = v.getResources();
        if (res != null)
            idString = res.getResourceEntryName(id);
    }//from  w ww.  j  a v a  2s.  c om
    return idString;
}

From source file:am.widget.tabstrip.TabStripHelper.java

@Nullable
private static ViewPager findViewPager(View view, int id, boolean traversal) {
    ViewPager pager = null;/*from  w  w w.  j  ava 2 s .c om*/
    if (id != View.NO_ID) {
        View target = null;
        final ViewParent parent = view.getParent();
        if (parent instanceof View)
            target = ((View) parent).findViewById(id);
        if (target == null)
            target = view.getRootView().findViewById(id);
        if (target instanceof ViewPager) {
            pager = (ViewPager) target;
        }
    }
    if (pager == null && traversal) {
        final ViewParent parent = view.getParent();
        if (parent instanceof View)
            pager = traversal((View) parent);
        if (pager == null)
            pager = traversal(view.getRootView());
    }
    return pager;
}

From source file:com.life360.android.protomap.tab.BottomNavigationBehavior.java

public BottomNavigationBehavior(Context context, AttributeSet attrs) {
    super(context, attrs);
    TypedArray a = context.obtainStyledAttributes(attrs, attrsArray);
    mTabLayoutId = a.getResourceId(0, View.NO_ID);
    a.recycle();//w  ww.j  a v  a2s .  co m
}

From source file:despotoski.nikola.github.com.bottomnavigationlayout.BottomNavigationBehavior.java

public BottomNavigationBehavior(Context context, AttributeSet attrs) {
    super(context, attrs);
    isTablet = context.getResources().getBoolean(R.bool.isTablet);
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BottomNavigationBehavior_Params);
    mTabLayoutId = a.getResourceId(R.styleable.BottomNavigationBehavior_Params_tabLayoutId, View.NO_ID);
    a.recycle();/*from  www . j  a v  a2s  . co  m*/
}

From source file:com.ouyangzn.view.TopDragLayout.java

private void init(Context context, AttributeSet attrs) {
    mDragHelper = ViewDragHelper.create(this, new ViewDragCallback());
    TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.TopDragLayout);
    mRemainHeight = ta.getDimensionPixelOffset(R.styleable.TopDragLayout_remain_height, 0);
    mThresholdHeight = ta.getDimensionPixelOffset(R.styleable.TopDragLayout_threshold_height, 0);
    mDraggedViewId = ta.getResourceId(R.styleable.TopDragLayout_dragged_view_id, View.NO_ID);
    ta.recycle();/*  w w w. j a  v a2 s .  co m*/
}

From source file:cn.youngkaaa.yviewpager.YFragmentPagerAdapter.java

@Override
public void startUpdate(ViewGroup container) {
    if (container.getId() == View.NO_ID) {
        throw new IllegalStateException("ViewPager with adapter " + this + " requires a view id");
    }/*from w  w w  . ja v  a 2 s. com*/
}

From source file:com.ouyangzn.view.TopDragLayout.java

@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    if (mDraggedViewId != View.NO_ID) {
        mDraggedView = findViewById(mDraggedViewId);
    } else {/*from  w  w w  . ja  v  a  2  s .  c o m*/
        mDraggedView = getChildAt(0);
    }
}

From source file:am.util.viewpager.adapter.FragmentRemovePagerAdapter.java

@Override
public void startUpdate(ViewGroup container) {
    mViewGroupId = container.getId();/*  w ww . j  a  v  a 2 s  .  co  m*/
    if (mViewGroupId == View.NO_ID) {
        throw new IllegalStateException("ViewPager with adapter " + this + " requires a view id");
    }
}

From source file:am.project.x.widget.FragmentRemovePagerAdapter.java

@Override
public void startUpdate(@NonNull ViewGroup container) {
    mViewGroupId = container.getId();/*from   w w w  .j  a v a2 s. c  o m*/
    if (mViewGroupId == View.NO_ID) {
        throw new IllegalStateException("ViewPager with adapter " + this + " requires a view id");
    }
}