Getting Issue drawing Line in Map between Two locations in android sdk

前端 未结 1 1577
误落风尘
误落风尘 2021-01-24 01:14
package com.hands;

import java.net.HttpURLConnection;
import java.net.URL;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

         


        
相关标签:
1条回答
  • 2021-01-24 01:53

    As the logcat explains, you are getting a NullPointerException when you call the method getDirectionData(). This method is not shown in the code above. Can you add this method so we can see what the problem is?

    Edit: Thanks for adding your getDirectionData() method. Its still not clear where the problem is but one issue is the fact that you have an empty catch block - this will swallow exceptions and then you carry on processing code. For example, if the line

    doc = db.parse(urlConnection.getInputStream());
    

    throws an exception or returns null, then you try to get the NodeList from a null object - this would give you your null pointer exception. I recommend putting a breakpoint at the start of this method and stepping through it, examining the variables as you go. This will identify the source of the problem.

    0 讨论(0)
提交回复
热议问题