title: Google Glass Fullscreen Custom Layout Cards
body: <p>I have an issue. Since the Card class is deprecated and the CardBuilder.EMBED_INSIDE is fairly limited. The only option is to use a custom View. I'd also like to use the CardScrollView and the CardScrollAdapter.</p>
  
  <p>visit <a href="https://stackoverflow.com/questions/27049873/google-glass-immersion-custom-layout-without-cardbuilder-layout-embed-inside/29728913?noredirect=1#comment47592481_29728913">Google Glass Immersion Custom Layout without CardBuilder.Layout.EMBED_INSIDE</a></p>
  
  <p>But my problem is, I can't have multiple views.</p>
  
  <p>Here is MyCustomViewClass:</p>
  
  <pre><code>   public class MyCustomView extends FrameLayout{
  public MyCustomView (Context context) {
      super(context);
      initView();
  }
  
  private void initView()
  {
      View view = inflate(getContext(), R.layout.imageview, null);
      addView(view);
  
      View view2 = inflate(getContext(), R.layout.secondview, null);
      addView(view2);
  }
  </code></pre>
  
  <p>And thats my main activity class:</p>
  
  <pre><code>public class InspectionActivity extends Activity {
  
  private CardScrollView mCardScroller;
  private GestureDetector mGestureDetector;
  private View mView;
  private CardScrollView _cardScroller;
  private ArrayList&lt;View&gt; _cardsList;
  private MyCustomView _myView;
  protected List&lt;CardBuilder&gt; mCards;
  @Override
  
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      createCards();
      _cardsList = new ArrayList&lt;View&gt;();
      _myView= new MyCustomView (this);
      _cardsList.add(_myView);
      _cardScroller = new CardScrollView(this) ;
      MainCardsScrollAdapter adapter = new MainCardsScrollAdapter(_cardsList);
      _cardScroller.setAdapter(adapter);
      _cardScroller.activate();
      setContentView(_cardScroller);
  }
  
  private void createCards() {
      mCards = new ArrayList&lt;CardBuilder&gt;();
  }
  public class MainCardsScrollAdapter extends CardScrollAdapter
  {
      ArrayList&lt;View&gt; _cardsList;
      public MainCardsScrollAdapter(ArrayList&lt;View&gt; cardsList)
      {
          _cardsList = cardsList;
      }
  
      @Override
      public int getCount() {
          return _cardsList.size();
      }
  
      @Override
      public Object getItem(int i) {
          return _cardsList.get(i);
      }
  
  
      @Override
      public View getView(int i, View view, ViewGroup viewGroup) {
          return _cardsList.get(i);
      }
  
      @Override
      public int getPosition(Object o) {
          return _cardsList.indexOf(o);
      }
  
      @Override
      public int getViewTypeCount() {
          return CardBuilder.getViewTypeCount();
      }
  
      @Override
      public int getItemViewType(int position){
          return 2;//should be changed, it's just an example
      }
  } }
  </code></pre>