我有这行代码,我在这里得到一个 NullPointerException
第 219 行 Search.java
Intent intent = new Intent((Context) actionBar, SearchResultsMap.class)
例外
04-25 17:30:00.485: W/System.err(6518): java.lang.NullPointerException
04-25 17:30:00.501: W/System.err(6518): at android.content.ComponentName.<init>(ComponentName.java:75)
04-25 17:30:00.501: W/System.err(6518): at android.content.Intent.<init>(Intent.java:2823)
04-25 17:30:00.501: W/System.err(6518): at com.itaxeeta.server.Search.onPostExecute(Search.java:219)
AndroidManifest
<activity
android:name="com.itaxeeta.SearchResultsMap"
android:configChanges="keyboardHidden|orientation"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Light.NoTitleBar" />
似乎 SearchResultsMap.class 即将作为 Null 出现,但它怎么可能,它是一个 Activity 并且它就在那里。它经常随机发生。我错过了什么?
编辑:为了清楚起见,添加了更多代码。
内部活动
public class HomeScreen extends MapActivity implements IActionBar
....
onClick() {
....
new Search(this, source, destination).execute();
...
}
}
搜索类
public Search(IActionBar actionBar, GeoPoint source, GeoPoint destination) {
super(actionBar);
this.source = source;
this.destination = destination;
}
public interface IActionBar {
public void setBusyVisibility(int visibility) ;
public void setSubscribedToCount() ;
public void setCurrentAddress(String address) ;
public void setSubscribedToDetails(CustomJourneyUserInformation[] result);
public Context getContext() ;
}