为什么不能通过将它的引用设置为null并让垃圾收集器删除它来终止线程?这是一个像任何其他的对象,不是吗?
例:
Thread t = new Thread(new Runnable() {
public void run() {
//...
}
}).start;
t = null;
Run Code Online (Sandbox Code Playgroud) 您好,我对http://developer.android.com/guide/topics/search/search-dialog.html上显示的搜索对话框感到沮丧
当我按下设备上的搜索按钮时,没有向我显示搜索对话框.这是我简单的清单文件:
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Main"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="android.app.default_searchable"
android:value=".Other" />
</activity>
<activity android:name=".Other">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="@xml/searchable"/>
</activity>
</application>
Run Code Online (Sandbox Code Playgroud)
我的res/xml/searchable.xml看起来像这样:
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="lol"
android:hint="search" >
</searchable>
Run Code Online (Sandbox Code Playgroud)
在Main.java中触发onSearchRequested(),但不显示搜索对话框.
我错过了什么吗?