title: How to open a Xamarin Forms page from a Xamarin Droid Activity from a onclick listener
body: <p>I am working on adding an assist feature to my app that when the user holds down on the home button an android activity opens with cards that the user can click on that then opens the xamarin forms page in question for example when the math card is clicked the MathPage xamarin forms page opens here's my android layout code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/activity_tools_home_view"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
      &lt;RelativeLayout
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:paddingTop="10dp"
          android:id="@+id/whole"
          tools:context="${relativePackage}.${activityClass}"
          tools:layout_editor_absoluteY="0dp"
          tools:layout_editor_absoluteX="0dp"&gt;
          &lt;LinearLayout
              android:layout_width="wrap_content"
              android:id="@+id/scroll"
              android:layout_height="wrap_content"&gt;
              &lt;android.support.v7.widget.CardView
                  android:id="@+id/one"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  app:cardBackgroundColor="@color/cardsbg"
                  app:cardElevation="3dp"
                  android:clickable="false"
                  tools:layout_conversion_absoluteX="16dp"
                  tools:layout_conversion_absoluteY="8dp"
                  tools:layout_conversion_absoluteWidth="379dp"
                  tools:layout_conversion_absoluteHeight="540dp"&gt;
                  &lt;RelativeLayout
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"&gt;
                      &lt;android.support.v7.widget.CardView
                          android:id="@+id/webcard"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:layout_marginBottom="4dp"
                          android:layout_marginRight="8dp"
                          android:layout_marginLeft="8dp"
                          android:layout_marginTop="8dp"
                          android:foreground="?android:attr/selectableItemBackground"
                          app:cardBackgroundColor="@color/card_background"
                          app:cardElevation="3dp"
                          android:clickable="true"
                          android:onClick="web"&gt;
                          &lt;RelativeLayout
                              android:layout_width="match_parent"
                              android:layout_height="match_parent"&gt;
                              &lt;ImageView
                                  android:id="@+id/webicon"
                                  android:layout_width="68dp"
                                  android:layout_height="68dp"
                                  android:layout_centerVertical="true"
                                  android:padding="5dp"
                                  android:src="@drawable/web" /&gt;
                              &lt;TextView
                                  android:id="@+id/web"
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:layout_centerVertical="true"
                                  android:layout_toRightOf="@id/webicon"
                                  android:text="Internet"
                                  android:paddingLeft="8dp"
                                  android:textColor="@color/cardText"
                                  android:textSize="20sp" /&gt;
                          &lt;/RelativeLayout&gt;
                      &lt;/android.support.v7.widget.CardView&gt;
                      &lt;android.support.v7.widget.CardView
                          android:id="@+id/mailcard"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:foreground="?android:attr/selectableItemBackground"
                          android:layout_marginBottom="4dp"
                          android:layout_marginRight="8dp"
                          android:layout_marginLeft="8dp"
                          android:layout_marginTop="4dp"
                          android:layout_below="@+id/webcard"
                          app:cardBackgroundColor="@color/card_background"
                          app:cardElevation="3dp"
                          android:clickable="true"
                          android:onClick="email"&gt;
                          &lt;RelativeLayout
                              android:layout_width="match_parent"
                              android:layout_height="match_parent"&gt;
                              &lt;ImageView
                                  android:id="@+id/emailicon"
                                  android:layout_width="68dp"
                                  android:layout_height="68dp"
                                  android:layout_centerVertical="true"
                                  android:padding="5dp"
                                  android:src="@drawable/email" /&gt;
                              &lt;TextView
                                  android:id="@+id/email"
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:paddingLeft="8dp"
                                  android:layout_centerVertical="true"
                                  android:layout_toRightOf="@id/emailicon"
                                  android:text="Email"
                                  android:textColor="@color/cardText"
                                  android:textSize="20sp" /&gt;
                          &lt;/RelativeLayout&gt;
                      &lt;/android.support.v7.widget.CardView&gt;
                      &lt;android.support.v7.widget.CardView
                          android:id="@+id/mathcard"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:foreground="?android:attr/selectableItemBackground"
                          android:layout_marginBottom="4dp"
                          android:layout_marginRight="8dp"
                          android:layout_marginLeft="8dp"
                          android:layout_marginTop="4dp"
                          android:layout_below="@+id/mailcard"
                          app:cardBackgroundColor="@color/card_background"
                          app:cardElevation="3dp"
                          android:clickable="true"
                          android:onClick="math"&gt;
                          &lt;RelativeLayout
                              android:layout_width="match_parent"
                              android:layout_height="match_parent"&gt;
                              &lt;ImageView
                                  android:id="@+id/musicicon"
                                  android:layout_width="68dp"
                                  android:layout_height="68dp"
                                  android:layout_centerVertical="true"
                                  android:padding="5dp"
                                  android:src="@drawable/math" /&gt;
                              &lt;TextView
                                  android:id="@+id/music"
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:layout_centerVertical="true"
                                  android:layout_toRightOf="@id/musicicon"
                                  android:text="Math"
                                  android:paddingLeft="8dp"
                                  android:textColor="@color/cardText"
                                  android:textSize="20sp" /&gt;
                          &lt;/RelativeLayout&gt;
                      &lt;/android.support.v7.widget.CardView&gt;
                      &lt;android.support.v7.widget.CardView
                          android:id="@+id/scicard"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:foreground="?android:attr/selectableItemBackground"
                          android:layout_marginBottom="8dp"
                          android:layout_marginRight="8dp"
                          android:layout_marginLeft="8dp"
                          android:layout_marginTop="4dp"
                          android:layout_below="@+id/mathcard"
                          app:cardBackgroundColor="@color/card_background"
                          app:cardElevation="3dp"
                          android:clickable="true"
                          android:onClick="science"&gt;
                          &lt;RelativeLayout
                              android:layout_width="match_parent"
                              android:layout_height="match_parent"&gt;
                              &lt;ImageView
                                  android:id="@+id/playicon"
                                  android:layout_width="68dp"
                                  android:layout_height="68dp"
                                  android:layout_centerVertical="true"
                                  android:padding="8dp"
                                  android:src="@drawable/sci" /&gt;
                              &lt;TextView
                                  android:id="@+id/play"
                                  android:layout_width="match_parent"
                                  android:layout_height="wrap_content"
                                  android:layout_centerVertical="true"
                                  android:paddingLeft="8dp"
                                  android:layout_toRightOf="@+id/playicon"
                                  android:text="Science"
                                  android:textColor="@color/cardText"
                                  android:textSize="20sp" /&gt;
                          &lt;/RelativeLayout&gt;
                      &lt;/android.support.v7.widget.CardView&gt;
                      &lt;android.support.v7.widget.CardView
                          android:id="@+id/englishcard"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:foreground="?android:attr/selectableItemBackground"
                          android:layout_marginBottom="8dp"
                          android:layout_marginRight="8dp"
                          android:layout_marginLeft="8dp"
                          android:layout_marginTop="4dp"
                          android:layout_below="@+id/scicard"
                          app:cardBackgroundColor="@color/card_background"
                          app:cardElevation="3dp"
                          android:clickable="true"
                          android:onClick="english"&gt;
                          &lt;RelativeLayout
                              android:layout_width="match_parent"
                              android:layout_height="match_parent"&gt;
                              &lt;ImageView
                                  android:id="@+id/playicon"
                                  android:layout_width="68dp"
                                  android:layout_height="68dp"
                                  android:layout_centerVertical="true"
                                  android:padding="8dp"
                                  android:src="@drawable/handwrittin" /&gt;
                              &lt;TextView
                                  android:id="@+id/play"
                                  android:layout_width="match_parent"
                                  android:layout_height="wrap_content"
                                  android:layout_centerVertical="true"
                                  android:paddingLeft="8dp"
                                  android:layout_toRightOf="@+id/playicon"
                                  android:text="Handwriting"
                                  android:textColor="@color/cardText"
                                  android:textSize="20sp" /&gt;
                          &lt;/RelativeLayout&gt;
                      &lt;/android.support.v7.widget.CardView&gt;
                      &lt;android.support.v7.widget.CardView
                          android:id="@+id/flashcard"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:foreground="?android:attr/selectableItemBackground"
                          android:layout_marginBottom="8dp"
                          android:layout_marginRight="8dp"
                          android:layout_marginLeft="8dp"
                          android:layout_marginTop="4dp"
                          android:layout_below="@+id/englishcard"
                          app:cardBackgroundColor="@color/card_background"
                          app:cardElevation="3dp"
                          android:clickable="true"
                          android:onClick="flashcard"&gt;
                          &lt;RelativeLayout
                              android:layout_width="match_parent"
                              android:layout_height="match_parent"&gt;
                              &lt;ImageView
                                  android:id="@+id/playicon"
                                  android:layout_width="68dp"
                                  android:layout_height="68dp"
                                  android:layout_centerVertical="true"
                                  android:padding="8dp"
                                  android:src="@drawable/flashcards" /&gt;
                              &lt;TextView
                                  android:id="@+id/play"
                                  android:layout_width="match_parent"
                                  android:layout_height="wrap_content"
                                  android:layout_centerVertical="true"
                                  android:paddingLeft="8dp"
                                  android:layout_toRightOf="@+id/playicon"
                                  android:text="Flashcards"
                                  android:textColor="@color/cardText"
                                  android:textSize="20sp" /&gt;
                          &lt;/RelativeLayout&gt;
                      &lt;/android.support.v7.widget.CardView&gt;
                      &lt;RelativeLayout
                          android:id="@+id/bttom"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:layout_below="@id/flashcard"
                          android:paddingTop="8dp"
                          android:layout_marginBottom="8dp"&gt;
                          &lt;Button
                              android:id="@+id/button_2"
                              android:onClick="cam"
                              android:foreground="?android:attr/selectableItemBackground"
                              android:layout_alignParentLeft="true"
                              android:layout_marginLeft="50dp"
                              android:layout_width="50dp"
                              android:layout_height="50dp"
                              android:background="@drawable/settings" /&gt;
                          &lt;Button
                              android:id="@+id/button_1"
                              android:onClick="settings"
                              android:foreground="?android:attr/selectableItemBackground"
                              android:layout_alignParentRight="true"
                              android:layout_marginRight="50dp"
                              android:layout_width="50dp"
                              android:layout_height="50dp"
                              android:background="@drawable/settings" /&gt;
                      &lt;/RelativeLayout&gt;
                  &lt;/RelativeLayout&gt;
              &lt;/android.support.v7.widget.CardView&gt;
          &lt;/LinearLayout&gt;
          &lt;Button
              android:layout_width="72dp"
              android:layout_height="72dp"
              android:id="@+id/button_4"
              android:onClick="now"
              android:layout_marginTop="-42dp"
              android:layout_below="@+id/scroll"
              android:foreground="?android:attr/selectableItemBackground"
              android:clipToPadding="false"
              android:layout_centerHorizontal="true"
              android:background="@drawable/books" /&gt;
      &lt;/RelativeLayout&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>heres my code behind:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  using Android.App;
  using Android.Content;
  using Android.Content.PM;
  using Android.OS;
  using Android.Runtime;
  using Android.Views;
  using Android.Widget;
  using Xamarin.Forms.Platform.Android;
  
  namespace AppName.Droid
  {
  [Activity(LaunchMode = LaunchMode.SingleInstance, Theme = "@style/Theme.Transparent")]
      [IntentFilter(new[] { Intent.ActionAssist }, Categories = new[] { Intent.CategoryDefault })]    
      public class ToolBelt : FormsApplicationActivity
      {
  
          Button mathbutton;
  
          protected override void OnCreate(Bundle bundle)
          {
              base.OnCreate(bundle);
  
              // Set our view from the "main" layout resource
              SetContentView(Resource.Layout.ToolBelt);
  
          }
  
  
          //Code That Opens The Math  Part!
  
          [Java.Interop.Export("math")] // The value found in android:onClick attribute.
          public void btnOneClick4(View v) // Does not need to match value in above attribute.
          {
  
              //code to open the MathPage Forms Page Goes here
          }
  
          //Code That Opens The Internet  App!
  
          [Java.Interop.Export("web")] // The value found in android:onClick attribute.
          public void btnOneClick8(View v) // Does not need to match value in above attribute.
          {
              var uri = Android.Net.Uri.Parse("http://www.google.com");
              var intent = new Intent(Intent.ActionView, uri);
              StartActivity(intent);
          }
  
  
  
          //Code That Opens The Gmail App!
  
          [Java.Interop.Export("email")] // The value found in android:onClick attribute.
          public void btnOneClick3(View v) // Does not need to match value in above attribute.
          {
              var intent = PackageManager.GetLaunchIntentForPackage("com.google.android.gm");
              StartActivity(intent);
          }
      }
  }
  </code></pre>