我嘗試使用的Andorid代碼在那個NullPointerException
發生在這條線,使在科爾多瓦一個PDF閱讀器plugina svScroll.setPDFViewer(this);
有不同勢類是有第一即時通訊呼叫硫雜PDFViewer
類Java代碼中的NullPointerException。在Activity參數中使用cordova活動時。
PDFViewer m_PDFViewer = new PDFViewer(cordova.getActivity());
所以任何機構可以幫助我解決這個問題
public class PDFViewer implements IPassword
{
private LinearLayout llPagePane;
private QScrollView svScroll;
private float m_CurrentScale;
private PDFDocument m_Document;
private float m_FitToWidth;
private LRUCache m_PageContentsCache;
private Vector<PDFPageView> m_PageViews;
private Activity m_ParentActivity;
private TouchHandlerView m_TouchHandler;
public PDFViewer(Activity parentActivity)
{
m_ParentActivity = parentActivity;
StandardFontTF.mAssetMgr = m_ParentActivity.getAssets();
llPagePane = (LinearLayout) parentActivity.findViewById(R.id.pagepane);
svScroll = (QScrollView) parentActivity.findViewById(R.id.scrollview);
svScroll.setPDFViewer(this);
m_PageContentsCache = new LRUCache(20);
m_PageViews = new Vector<PDFPageView>();
m_TouchHandler = new TouchHandlerView(this);
}
java.lang.NullPointerException
at com.pdfplugin.PDFViewer.<init>(PDFViewer.java:55)
at com.pdfplugin.pdfreader$1.run(pdfreader.java:69)
public void setPDFViewer(PDFViewer viewer)
{
m_PDFViewer = viewer;
}
哪一行是55行? – 2013-02-12 13:28:04
svScroll.setPDFViewer(this); 是第55行 – 2013-02-12 13:32:04
那麼大概'svScroll'爲空,因爲'findViewById'已經返回null ... – 2013-02-12 13:32:39