I ran into following error.
logUser("An error happend while creating graph:"+ getErrorMessage());
Where getErrorMessage() is Can't create handler inside thread that has not called Looper.prepare() and logUser is a function which just show toast congaing message.
void prepareGraph() {
logUser("loading graph (" + Helper.VERSION + "|" + Helper.VERSION_FILE
+ ") ... ");
new MyAsyncTask<Void, Void, Path>() {
protected Path saveDoInBackground(Void... v) throws Exception {
GraphHopper tmpHopp = new GraphHopper().forAndroid();
tmpHopp.contractionHierarchies(true);
tmpHopp.load(mapsFolder + currentArea);
logUser("found graph with " + tmpHopp.getGraph().nodes() + " nodes");
hopper = tmpHopp;
return null;
}
protected void onPostExecute(Path o) {
if (hasError()) {
logUser("An error happend while creating graph:"
+ getErrorMessage());
} else {
logUser("Finished loading graph. Touch to route.");
calcPath(52.534185, 13.348732, 52.53857,
13.41259);
}
finishPrepare();
}
}.execute();
}