When running the application in android it
automatically crashes the application because of the null pointer exception.There
are different types of null pointer exception are available in android,now on
this time we are going to see the unknown resource null pointer exception.
06-15 11:41:09.356: E/AndroidRuntime(1116): FATAL
EXCEPTION: main
06-15 11:41:09.356: E/AndroidRuntime(1116): Process:
com.example.sampleclass, PID: 1116
06-15 11:41:09.356: E/AndroidRuntime(1116):
java.lang.NullPointerException
Solution
To resolve this error firstly you need to check how
many layout files your are having,for example if you are having one layout file
called activity_main.xml in your
layout folder.Now you need to sink this layout file properly in your java file
for example
MainActivity.java
public class
MainActivity extends Activity {
@Override
protected void onCreate(Bundle
savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.abc_search_view);
}
}
Now listen properly layout folder having only the
activity_main.xml file now your java file is trying to sink the another file
which is not available.
setContentView(R.layout.abc_search_view);
for rectifying this issue replace the
code like this.
setContentView(R.layout.activity_main);
This is the problem in your android
application.It differs from many exception and there are lot of null pointer
exception available.Search according to your exception if you have doubts
comment it below.
No comments:
Post a Comment