When I launch my app this problem shows. This is my Java code:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(layout.activity_main);
ImageView imageView = new ImageView(this);
imageView.setBackgroundColor(Color.WHITE);
SVG svg = SVGParser.getSVGFromResource(getResources(), raw.canel);`
imageView.setImageDrawable(svg.createPictureDrawable());
setContentView(imageView);
}
This is the line where the exception is thrown:
There are two possibilities: either
SVGParserisnulland therefore has nogetSVGFromResource, orrawisnulland has nocanelmember.If your error is that
SVGParserisnull, then the problem is that you did notimportSVGParser. In this case the solution is to import the package which containsSVGParser, since it is aclassand it was notimported, therefore the compiler thinks it is a variable and has not been initialized.If your error is that
rawisnull, then the solution is to initialize it. In this case you have missed the part where the variable is being initialized. It is quite possible that you initialize it correctly, but afteronCreateis being called, therefore the member is not initialized yet when you try to use it.We need more information about the problem to give you a more specific solution.