Was ist der richtige Weg, um einen GridViewPager auf Android Wear zu implementieren?

Ich versuche, einen GridViewPager zu implementieren, damit ich zwischen zwei eindeutigen Ansichten wechseln kann. Bisher konnte ich noch keine Aufrufe hinzufügen. Unten ist mein Code

public class Gridder extends Activity {

private TextView mTextView;
GridViewPager gridViewPager;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_gridder);
    final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
    final LayoutInflater inflater = getLayoutInflater();
    stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
        @Override
        public void onLayoutInflated(WatchViewStub stub) {
            gridViewPager = (GridViewPager) findViewById(R.id.pager);
            gridViewPager.setAdapter(new MyGridViewPagerAdapter());
            gridViewPager.addView(inflater.inflate(R.layout.selector_generic, stub));;
        }
    });
}

private class MyGridViewPagerAdapter extends GridPagerAdapter {
    @Override
    protected void destroyItem(ViewGroup arg0, int arg1, int arg2, Object arg3) {
    }

    @Override
    public int getColumnCount(int arg0) {
        return 1;
    }

    @Override
    public int getRowCount() {
        return 1;
    }

    @Override
    protected Object instantiateItem(ViewGroup arg0, int arg1, int arg2) {
        return null;
    }

    @Override
    public boolean isViewFromObject(View arg0, Object arg1) {
        return false;
    }
}

Im untergeordneten Rechteck des Hauptansichts-Stubs habe ich einen GridViewPager mit dem ID-Pager, genau wie oben angegeben:

<android.support.wearable.view.GridViewPager
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:keepScreenOn="true" />

Dieser Code löst eine unzulässige Statusausnahme aus und meldet, dass meine untergeordnete Ansicht bereits übergeordnete Elemente verfügt. Siehe unten

07-16 14:44:40.847  12940-12940/com.larvalabs.weartest E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.larvalabs.weartest, PID: 12940
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
        at android.view.ViewGroup.addViewInner(ViewGroup.java:3561)
        at android.view.ViewGroup.addView(ViewGroup.java:3414)
        at android.support.wearable.view.GridViewPager.addView(GridViewPager.java:1088)
        at android.view.ViewGroup.addView(ViewGroup.java:3359)
        at android.view.ViewGroup.addView(ViewGroup.java:3335)
        at com.larvalabs.weartest.Gridder$1.onLayoutInflated(Gridder.java:30)
        at android.support.wearable.view.WatchViewStub.inflate(WatchViewStub.java:133)
        at android.support.wearable.view.WatchViewStub.onMeasure(WatchViewStub.java:141)
        at android.view.View.measure(View.java:16648)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
        at android.view.View.measure(View.java:16648)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
        at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2321)
        at android.view.View.measure(View.java:16648)
        at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1959)
        at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1145)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1340)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1032)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5657)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
        at android.view.Choreographer.doCallbacks(Choreographer.java:574)
        at android.view.Choreographer.doFrame(Choreographer.java:544)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
        at android.os.Handler.handleCallback(Handler.java:733)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5026)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
        at dalvik.system.NativeStart.main(Native Method)

Antworten auf die Frage(1)

Ihre Antwort auf die Frage