Array
(
)

search dialog no monodroid?

Wagner Almeida
|
MVP
    26 mar 2012

Oi, poderia nós ajudar como implementar pesquisa search dialog no monodroid?
Obrigado!

Joel Rodrigues
   - 26 mar 2012

Esses links podem lhe ajudar:

http://developer.android.com/guide/topics/search/search-dialog.html
http://i41.tinypic.com/1zbds02.jpg

Boa sorte.

Wagner Almeida
|
MVP
    26 mar 2012

Já tentei seguir esse exemplo mas não consigo fazer funcionar, versão android 2.3

- criei um activity SearchActivity.cs
using System;
using Android.App;
using Android.Content;
using Android.OS;

namespace MonoAndroidAPTecnologiaMobile
{
[Activity(Label = Searchable, LaunchMode = Android.Content.PM.LaunchMode.SingleTop)]
[IntentFilter(new[] { Intent.ActionMain }, Categories = new[] { Intent.CategoryLauncher, Intent.ActionSearch })]
[MetaData(searchable, Resource = @xml/searchable)]
public class SearchActivity : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);

// Create your application here
}
}
}

- criei searchable.xml
<?xml version=1.0 encoding=utf-8?>
<searchable
xmlns:android=http://schemas.android.com/apk/res/android
android:label=MyLabel
android:hint=Search Products>
</searchable>

- Activity1.cs
[Activity(Label = MonoAndroidAPTecnologiaMobile, MainLauncher = true, Icon = @drawable/icon)]
[MetaData(android.app.default_searchable, Value = searchdialogtest.SearchActivity)]
public class Activity1 : Activity

- ActivityProdutos.cs que contem o listview
[Activity(Label = Produtos, Icon = @drawable/icon)]
[MetaData(android.app.default_searchable, Value = searchdialogtest.SearchActivity)]
public class ActivityProdutos : Activity

- AndroidManifest.xml
<?xml version=1.0 encoding=utf-8?>
<manifest xmlns:android=http://schemas.android.com/apk/res/android android:installLocation=internalOnly>
<application>

<activity android:name=.SearchableActivity android:launchMode=singleTop >
<intent-filter>
<action android:name=android.intent.action.SEARCH />
</intent-filter>
<meta-data android:name=android.app.searchable
android:resource=@xml/searchable/>
</activity>

</application>
<uses-sdk android:minSdkVersion=10 />
</manifest>