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

How to get original IP address of a client in java? [duplicate]
Unable to create new remote session - Selenium webdriver
JDBC won't update PostgreSQL database
When can JVM (or OS) close the file handler abnormally?
Slick2D weird focus/graphical window glitch-like issue?
Maven jar plugin looking for non-existent log4j file
What gets sent to a application when you open a file?
Generics - The method in the type is not applicable for the arguments
In the below example, How does function have access to private variable of an object? [duplicate]
JAVA Read File in Chunks, every chunk to HEX
When call the same method from parent by super word [duplicate]
ArrayList for loop iterator causing infinite loop
Signed right shift operator on negative operands
Combobox not getting focus in JTable - Java 8
Asn1 Tag contents
How to place HashSets INSIDE of a HashMap?

Categories

HOME
image
webpack
minimum-spanning-tree
analysis
jsrender
sharepoint-designer
twitter-bootstrap-4
umd
azure-storage-tables
ios-charts
contact
medical
elasticsearch-hadoop
dacpac
usergrid
ibm-odm
visual-studio-cordova
saxon
ab-testing
plunker
xlsxwriter
intentfilter
google-search-api
telerik-reporting
format-specifiers
one-to-many
facebook-access-token
internet-explorer-9
virtualdub
social-media
ejabberd-module
frame
stormpath
mozilla
rotational-matrices
web-mining
lto
vapor
sencha-touch-2.3
executenonquery
prolog-setof
promela
clean-architecture
dropbox-php
veracode
lowpass-filter
feeds
boost-preprocessor
spring-mongodb
crosswalk-runtime
quartz-composer
eventkit
infix-notation
ado.net-entity-data-model
sts-springsourcetoolsuite
google-web-starter-kit
merge-conflict-resolution
flash-cs5
persist
pagedlist
testng-dataprovider
qgraphicsview
bluemix-app-scan
cloudbees
tcpserver
separator
marching-cubes
deis
responsive-images
php-ci
arcanist
graph-drawing
ami
operator-precedence
oxwall
google-style-guide
android-imagebutton
websocket4net
issuu
google-reader
article
system.net.webexception
jboss-weld
meteor-velocity
apc
lcs
bitsharp
manchester-syntax
appconkit
work-stealing
custom-backend
hirefire
vdsp
dentrix
audio-capture
data-acquisition
django-notification

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App