Java 使用SearchDialog意图打开活动活动

Java 使用SearchDialog意图打开活动活动,java,android,search,Java,Android,Search,我正在我的应用程序中实现一个搜索对话框,我已经为我的活动配置了意图过滤器,并且已经使用意图调用了它,但同一个活动是我的主要活动,我需要处理已经运行的活动的意图,当事件发生时,将创建“我的活动”的新实例,并再次调用onCreate 这是我的密码 public class MainActivity extends Activity { private int ht; private ImageView img; private Bitmap bmp; private

我正在我的应用程序中实现一个搜索对话框,我已经为我的活动配置了意图过滤器,并且已经使用意图调用了它,但同一个活动是我的主要活动,我需要处理已经运行的活动的意图,当事件发生时,将创建“我的活动”的新实例,并再次调用onCreate

这是我的密码

public class MainActivity extends Activity {
    private int ht;
    private ImageView img;
    private Bitmap bmp;

    private int width = 612, height = 792;

    public void onCreate(Bundle savedInstance) {
        super.onCreate(savedInstance);

        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);

        setContentView(R.layout.main);

        img = (ImageView) findViewById(R.id.image01);
        img.setMinimumHeight(height);
        img.setMinimumWidth(width);

        draw();
        refreshImage();

        handleIntent(getIntent());
    }

    protected void onNewIntent(Intent intent) {
        setIntent(intent);
        handleIntent(intent);
    }


    private void search(String text) {
    //Do the search
    }


    private void handleIntent(Intent intent) {
        if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
            String query = intent.getStringExtra(SearchManager.QUERY);
            search(query);
        }
    }
}
和过滤器:

        <activity android:name="MainrActivity"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
                <action android:name="android.intent.action.SEARCH" />
            </intent-filter>
            <meta-data android:name="android.app.searchable"
                android:resource="@xml/searchable" />
        </activity>

searchable.xml文件

<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
    android:label="@string/app_name"
    android:hint="Search text..." >
</searchable> 

如何在打开的活动中处理此意图?

<activity android:name="MainActivity" 
          android:launchMode="singleTop"