Code example for ViewStub

Methods: inflate

    private View getStubView(int stubId, int viewId) {
        View view = findViewById(viewId);
        if (view == null) {
            ViewStub stub = (ViewStub) findViewById(stubId);
            view = stub.inflate();
        return view;
    private class MessageOnClick implements OnClickListener {
        private int mWhat;
        public MessageOnClick(int what) {
            mWhat = what;
        public void onClick(View v) {
            Message msg = Message.obtain(mHandler, mWhat);
Connect your IDE to all the code out there  Get Codota for Java