Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/221.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 可搜索界面-应用程序强制关闭_Android - Fatal编程技术网

Android 可搜索界面-应用程序强制关闭

Android 可搜索界面-应用程序强制关闭,android,Android,因此,我正在制作一个android应用程序,一旦试图进入我的最后一个活动,我的应用程序就会崩溃。请检查一下我是否遗漏了什么 Search1.Java Searchresults.java 最后是两个文件的清单 <activity android:name=".SearchResults" > <intent-filter> <action android:name="android.intent.action.SEARCH" /> </inten

因此,我正在制作一个android应用程序,一旦试图进入我的最后一个活动,我的应用程序就会崩溃。请检查一下我是否遗漏了什么

Search1.Java Searchresults.java 最后是两个文件的清单

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



Searchresults活动仍然不完整(xml文件只包含一个textview),但我仍然不认为在我尝试进入该活动时应用程序应该强制关闭。这段代码有什么问题吗?

我通常忘记将我的活动放在AndroidManifest.xml中,您检查过这是否是问题吗?=)

你得到了什么样的例外?这两个活动的清单都在下面,我的帖子的底部,所以不应该是这样。
public class SearchResults extends ListActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.search);

// Get the intent, verify the action and get the query
Intent intent = getIntent();
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
  String query = intent.getStringExtra(SearchManager.QUERY);
}
}
<activity android:name=".SearchResults" >
<intent-filter>
    <action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data android:name="android.app.searchable"
           android:resource="@xml/searchable"/>
</activity>
<activity    android:name=".Search1"
             android:label="@string/app_name"
             android:screenOrientation="portrait"> 
             <meta-data android:name="android.app.default_searchable"
                        android:value=".SearchResults" /> 
</activity>