我正在尝试调用不同包中类的公共方法。我已经导入了包,所以这不是问题。我正在使用 eclipse,它给了我下面提到的错误。
代码:
public class BookView extends LinearLayout
implements TextToSpeech.OnInitListener
{
private static final String LOGTAG = "BookView";
private EPubWebView afd_webView;
private Context afd_curContext;
private FrameLayout afd_tableContentView;
private String afd_cachePath = "";
private EPubDriver afd_epubDriver;
private AdView adView;
private int currentPageNum = 1;
private int totalPages;
private int current_chapter;
private int current_percent;
private int pIndex;
private int sIndex;
private int size;
private int chapterSize;
private int bookSize;
private String clickBk;
private String bookPath;
private String mDir = "/sdcard";
private List<Map<String, Object>> mDataList;
private ListView bookListView;
private Handler handler = new Handler();
private PopupWindow mBooksWindow;
private int andVersion;
private TextToSpeech tts;
private final String errorMessage = "Download Error!";
private boolean downloadCancel = false;
private boolean isDownloading = false;
public BookView(Context context, AttributeSet attrs)
{
super(context, attrs);
setOrientation(1);
this.afd_curContext = context;
this.handler.postDelayed(new Runnable()
{
public void run()
{
BookView.this.doAdMob();
}
}
, 10000L);
this.tts = new TextToSpeech(context, this);
this.afd_webView = new EPubWebView(context);
DisplayMetrics metrics = new DisplayMetrics();
((Activity)context).getWindowManager().getDefaultDisplay()
.getMetrics(metrics);
LayoutInflater inflater = (LayoutInflater)context
.getSystemService("layout_inflater");
inflater.inflate(R.layout.afd_bookview, this);
init();
}
public void jsImportBook(String epubBookPath) {
if (!BookView.this.importBook(epubBookPath))
return;
BookView.this.createBookshelf();
}
}
下面的调用方法是否正确?
public void importnewbook(String epubBookPath) {
BookView v = new BookView();
result = v.jsImportBook(epubBookPath);
}
我得到的错误:1)构造函数BookView()未定义2)方法jsImportBook(String)对于BookView类型未定义