Weird NullpointerException android.content.ComponentName -


i have line of code, getting nullpointerexception here

line 219 search.java

intent intent = new intent((context) actionbar, searchresultsmap.class)

exception

04-25 17:30:00.485: w/system.err(6518): java.lang.nullpointerexception 04-25 17:30:00.501: w/system.err(6518):     @ android.content.componentname.<init>(componentname.java:75) 04-25 17:30:00.501: w/system.err(6518):     @ android.content.intent.<init>(intent.java:2823) 04-25 17:30:00.501: w/system.err(6518):     @ 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" /> 

seems searchresultsmap.class coming null, how it, activity , right there. happens randomly, often. missing ?

edit : added more code clarity.

inside activity

public class homescreen extends mapactivity implements iactionbar    ....    onclick() {    ....    new search(this, source, destination).execute();        ...    } } 

search class

 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() ; } 

use

intent intent = new intent(getapplicationcontext(), searchresultsmap.class) 

or

intent intent = new intent(your_classname.this, searchresultsmap.class) 

instead of

intent intent = new intent((context) actionbar, searchresultsmap.class) 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -