2017-06-14 31 views
1

編輯:我鑼重新表述的問題,我怎樣才能使我的Xamarin窗體應用程序中可用的應用程序列表中顯示,當用戶點擊瀏覽按鈕在網頁,例如images.google.com或Facebook(發佈或評論)? 我似乎有一個正確的概念,我知道我需要這樣做的意圖,但我無法找到產生正確結果的動作或類別組合。請協助。啓動窗體應用程序時,瀏覽文件在網頁上點擊

我有一個Xamarin窗體應用程序有3個部分,當你點擊應用程序圖標,這完美的作品,其打開默認的啓動,那我也從這個意圖啓動圖像管理器部分...

[Activity(MainLauncher = false, NoHistory = true, Icon = "@drawable/icon", Theme = "@style/LaunchTheme", 
     ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] 
[IntentFilter(
    new[] { Intent.ActionView }, 
    Categories = new[] 
    { 
     Intent.CategoryDefault, 
     Intent.CategoryBrowsable, 
    }, 
    DataScheme = "file", 
    DataMimeType = "*/*", 
    DataPathPattern = ".*\\.jpg" 

)] 

圖像編輯完成後,可以將其保存到應用程序中的庫(這實際上是一個由Azure存儲支持的SQL數據庫)。 現在我想要做的是讓第三部分,即所有託管圖像庫,在您點擊網頁中的文件瀏覽按鈕時進入選項。目前,我的設備顯示「圖庫」和「主圖片」作爲選項,意圖是什麼讓這種情況發生?

When this browse button is clicked, I want my app to be in the list of handlers

感謝 Shaine。

編輯: 在這一點上我知道我需要做的IntentFilter到Intent.ActionGetContent,像...

[Activity(MainLauncher = false, NoHistory = true, Icon = "@drawable/icon", Theme = "@style/LaunchTheme", 
    ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] 
[IntentFilter(
new[] { Intent.ActionView }, 
Categories = new[] 
{ 
    Intent.CategoryDefault, 
    Intent.CategoryBrowsable, 
    Intet.CategoryOpenable 
}, 
DataScheme = "file", 
DataMimeType = "image/*" 
)] 

但是,我不知道下一步是什麼, Xamarin在這方面的文檔很少,如果它們存在的話。任何幫助讚賞。

+0

試試這個:意向意圖=新意圖(); intent.setAction(android.content.Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file),「image/*」); intent.startActivity(intent); –

+0

@YorkShen,可悲的是。你會認爲這會更容易。我想要做的就是將一個活動啓動爲一個畫廊,我不知道我做錯了什麼。該應用程序可用作打開圖像的資源,完美的作品,但作爲一個畫廊應用程序,遠遠不及。謝謝 –

回答

0

答案是...

[IntentFilter(new[] { Intent.ActionView, Intent.ActionPick, Intent.ActionGetContent }, Categories = new[] { Intent.CategoryDefault, Intent.CategoryOpenable }, DataMimeType = @"image/*")] 

感謝

相關問題