我在共享选项列表中点击我的应用后,尝试导航回我的主页。
这是我的主页:https://gyazo.com/831db63433d9b3e2051ed605dc3489af
当我在此处的共享选项列表中点击我的应用时:https://gyazo.com/47234162530078e1a83cdfb17eaf5401
我来到这个页面:https://gyazo.com/11cfb0f6818127e2cd4ef51d5ed970b9
但是当我在共享选项列表中单击我的应用程序时,我想导航到图片1。我怎样才能做到这一点?共享意图活动位于AndroidManifest.xml中,如图所示。图1中显示的页面称为" TabbedPagePage"这就是我想要的页面,而不是这个丑陋,没有内容的黑暗图片。
答案 0 :(得分:0)
您似乎需要为IntentFilter
设置MainActivity
,而不是使用其他活动。
它最终会导航到主页面
例如:
[Activity(Label = "Navigatetomainpage", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
[IntentFilter(new[] { Intent.ActionSend }, Categories = new[] { Intent.CategoryDefault }, DataMimeType = "image/*", Label = "Navigatetomainpage")]
[IntentFilter(new[] { Intent.ActionSend }, Categories = new[] { Intent.CategoryDefault }, DataMimeType = "text/plain", Label = "Navigatetomainpage")]
[IntentFilter(new[] { Intent.ActionSendMultiple }, Categories = new[] { Intent.CategoryDefault }, DataMimeType = "image/*", Label = "Navigatetomainpage")]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
{
Intent intent = Intent;
String action = Intent.Action;
String type = intent.Type;
if (Intent.ActionSend.Equals(action) && type != null)
{
if ("text/plain".Equals(type))
{
// Handle text being sent
// ...
// ...
// ...
}
else if (type.StartsWith("image/"))
{
// Handle single image being sent
// ...
// ...
// ...
}
}
else if (Intent.ActionSendMultiple.Equals(action) && type != null)
{
if (type.StartsWith("image/"))
{
// Handle multiple images being sent
// ...
// ...
// ...
}
}
else
{
// Handle other intents, such as being started from the home screen
}
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App());
}
}