java


Webview android application crashes with error “java.lang.NullPointerException”


It is a simple app to display a website with WebView. The application runs for a while but when I continue using it, it crashes and gives the following error.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.sauhardachhetri.projeck, PID: 3733
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
at com.android.webview.chromium.WebViewContentsClientAdapter.getDefaultVideoPoster(WebViewContentsClientAdapter.java:1181)
at org.chromium.android_webview.DefaultVideoPosterRequestHandler$1.run(DefaultVideoPosterRequestHandler.java:39)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
The fragment java file looks something like
package com.example.sauhardachhetri.projeck;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class mobilePrice extends Fragment {
public mobilePrice() {
// Required empty public constructor
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View rootview=inflater.inflate(R.layout.fragment_mobile_price,container,false);
WebView Hell=((WebView)rootview.findViewById(R.id.mobilewebsurface));
Hell.getSettings().setJavaScriptEnabled(true);
Hell.setWebViewClient(new WebViewClient());
Hell.loadUrl("http://www.gadgetsinnepal.com/category/mobile-price/");
return rootview;
}
}

Related Links

Convert java object in to pipe delimited string
Regex to match a pattern and group correct elements
Setting image view bitmap as a returned bitmap
Swing layout with resizable and fixed-size labels
Unload native library
Host unreachable admin prohibited
Why is not possible to reopen a closed (standard) stream?
Spring Application loads twice
How to find memory leakage in J2EE application without having a source code
Prevent ActionBar back button to recreate the MainActivity
Throw runtime exception in Closable.close()
Is there a new schema location for websphere ibm-web-bnd.xml?
Java: How to get the difference of the current date, and then an inputted date [duplicate]
There is an issue with my if-else statements where my variables are not getting initialized
ActionBarDrawerToggle not accepting R.drawable file
Why does my client Socket not connect to my ServerSocket?

Categories

HOME
pandas
wso2-am
minimum-spanning-tree
iterator
tesseract
youtube-dl
spring-jdbc
jsrender
umd
sql-server-2016
echarts
node-notifier
pheatmap
session-variables
resize
task
fortumo
progressive-web-apps
ef-migrations
connection-string
excel-vba-mac
mps
sox
mustache.php
chromium-embedded
captiveportal
applozic
elasticsearch-ruby
vision
kendo-datasource
r-raster
stringtemplate
xmlreader
io-redirection
xcode-extension
lumberjack
cookiecutter-django
google-closure
nomethoderror
eigenvalue
mime
network-flow
qsslsocket
boost-multi-index
python-webbrowser
veracode
csound
knpmenubundle
linode
arrow-keys
webdriverjs
redundancy
cubes
parallel-data-warehouse
android-textview
bonobo
ado.net-entity-data-model
dlna
system.management
javax.sound.midi
hsv
msys
retina
security-testing
ideamart
unity3d-gui
p2
lustre
block-device
operator-precedence
neolane
hyprlinkr
access-rights
html4
trusted
first-responder
tridion-worldserver
bubble-chart
subscript
vdsp
mod-auth
psi
recent-documents
krl
html-input
preference
firefox-5
iweb
avatar
aquaticprime

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App