java - Extension of ImageView crashes on construction in Android test project -


i trying test class have created extends imageview. crashed on construction, apparently before running code (stepping through debugger didn't reach breakpoints in construction code). sanity check created class:

package com.blah.thing;  import android.content.context; import android.util.attributeset; import android.widget.imageview;  public class donothing extends imageview {      public donothing(context context) {         super(context);         // todo auto-generated constructor stub     }      public donothing(context context, attributeset attrs) {         super(context, attrs);         // todo auto-generated constructor stub     }      public donothing(context context, attributeset attrs, int defstyle) {         super(context, attrs, defstyle);         // todo auto-generated constructor stub     }  } 

it still crashes. calling activity nothing (so far):

    public void oncreate(bundle savedinstancestate)     {         super.oncreate(savedinstancestate);         context context = getapplicationcontext();         donothing dn = new donothing(context);         setcontentview(r.layout.main);     } 

this activity in android test project alongside main project ... there need fix dependencies or something? way importing packages need refer donothing, context , on.

thanks!

try use

donothing dn = new donothing(this);  

instead of

context context = getapplicationcontext();          donothing dn = new donothing(context);  

on oncreate(...)


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -