Looking at your code, you probably call a simple constructor
public Mapitems(Drawable defaultMarker)
This constructor does not set mContext and why you get a NullPointerException.
Adding a string like mContext = new Context() or mContext = android.content.getApplicationContext() may solve the problem.
It is also possible that a null argument is passed to another constructor.
public Mapitems(Drawable defaultMarker, Context context)
Inserting a null check when assigning mContext and providing a default context if necessary can then solve the problem.
Constructors will look like this:
public Mapitems(Drawable defaultMarker) { super(boundCenterBottom(defaultMarker)); mContext = android.content.getApplicationContext(); // or: mContext = new Context(); } public Mapitems(Drawable defaultMarker, Context context) { super(defaultMarker); if(context==null) mContext = android.content.getApplicationContext(); // or: mContext = new Context(); mContext = context; }
Hope this solves your problem.
neXus source share