別のパッケージ内のクラスのパブリック メソッドを呼び出そうとしています。私はすでにパッケージをインポートしているので、それは問題ではありません。私は日食を使用していますが、以下のエラーが発生しています。
コード:
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 に対して未定義です