在我的情况下,我有一个应用程序,它是一个webview应用程序。 4.1或更高版本使用getUrl()将返回路径。但是当我使用Android 4.0时,它将返回null。 我已经做了很多搜索这种情况。但找不到答案。 任何人都可以帮助我吗?Android webview get url返回null
回答
“public String getUrl()
获取当前页面的URL,这并不总是与传递给WebViewClient.onPageStarted的URL相同,因为尽管该URL的负载已经开始,但当前页面可能没有改变。 (c)Android Developers
因此,如果您的页面尚未加载,那么getUrl将返回null。尝试在您的自定义WebViewClient中的onPageFinished中调用它,以进行检查。
我已经使用它之前它是在4.1 - 4.4之间的工作。但是当我使用只是不工作的4.0设备。 – user2357288 2014-11-04 02:20:42
@ user2357288我在HTC Sensation(4.0)上测试了它。一切正常。 – QArea 2014-11-04 09:56:57
我仍然无法解决问题。但我用另一种方法来处理这个问题。也许这将是简单而灵活的。任何地方,感谢您的建议。 =] – user2357288 2015-02-14 02:42:15
- 1. Android的webview cookie返回null
- 2. android get activity返回null
- 3. Angular 2 HTTP GET返回URL null
- 4. Android WebView数据库存储返回null
- 5. findViewById为WebView返回null
- 6. Cookie :: get()返回null
- 7. @ArquillianResource返回null URL
- 8. hibernate session get返回null
- 9. Morphia(MongoDB)Datastore“get”返回null
- 10. android intent.getAction()返回null
- 11. GET(URL)返回错误
- 12. CookieManager.getCookie()返回null
- 13. Android BaseAdapter:getTag()返回null
- 14. Android - GsonRequest返回null
- 15. Android BitmapFactory.decodeFile返回null
- 16. Android - MediaStore.Video.query()返回null
- 17. Android findFragmentById返回null
- 18. Android findViewById返回null
- 19. Android getParcelableExtra返回null
- 20. android getlastknownlocation返回null
- 21. Android - BitmapFactory.decodeByteArray返回null
- 22. Android ListView:getTag()返回NULL
- 23. android sharedpreferences返回null
- 24. Android,findViewById返回null
- 25. Android getAuthToken返回null
- 26. Android ProgressDialog返回null
- 27. BitmapFactory返回null Android
- 28. Android lastKnownLocation返回null
- 29. android BluetoothDevice.getName()返回null
- 30. Android bitmap.getwidth返回null?
发布您正在使用的代码。 – Salem 2014-11-03 10:18:58
写更多的代码,你试试什么和错误? – 2014-11-03 10:40:27