我写了个listView的适配器,把适配器给写在了一个SdcardActivity中,成了一个内部类。现在我同包下其他的类想要复用这个适配器,但我又不想去修改SdcardActivity这个类,也不能直接把适配器内部类直接给改成静态的,请问我需要怎么做才能复用这个适配器呢?
我直接在另外一个activity的onCreate方法中new适配器的构造方法是这样的
public MyAdapter(Context context){
this.mInflater = LayoutInflater.from(context);
}
其中MyAdapter类在SdcardActivity类中。SdcardActivity.MyAdapter listAdapter = new SdcardActivity().MyAdapter(this);我直接new,会报错The method MyAdapter(BrowseActivity) is undefined for the type SdcardActivity
我在构造方法里面传的是个context,为何不行呢?