Fix issue 679.

This commit is contained in:
Jimmy Shih
2011-12-21 18:27:11 -08:00
parent 339b045697
commit 22dafff7b7
@@ -116,7 +116,7 @@ public class ImportAllTracks {
Log.i(Constants.TAG, "ImportAllTracks: Releasing wake lock."); Log.i(Constants.TAG, "ImportAllTracks: Releasing wake lock.");
} }
activity.runOnUiThread(new Thread() { activity.runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
showDoneDialog(); showDoneDialog();
@@ -219,7 +219,7 @@ public class ImportAllTracks {
* Attempts to import a GPX file. Returns true on success, issues error * Attempts to import a GPX file. Returns true on success, issues error
* notifications and returns false on failure. * notifications and returns false on failure.
*/ */
private boolean importFile(File gpxFile, MyTracksProviderUtils providerUtils) { private boolean importFile(final File gpxFile, MyTracksProviderUtils providerUtils) {
Log.i(Constants.TAG, "ImportAllTracks: importing: " + gpxFile.getName()); Log.i(Constants.TAG, "ImportAllTracks: importing: " + gpxFile.getName());
try { try {
importedTrackIds = GpxImporter.importGPXFile(new FileInputStream(gpxFile), providerUtils); importedTrackIds = GpxImporter.importGPXFile(new FileInputStream(gpxFile), providerUtils);
@@ -234,8 +234,13 @@ public class ImportAllTracks {
} catch (IOException e) { } catch (IOException e) {
Log.w(Constants.TAG, "Error reading file: " + gpxFile.getAbsolutePath(), e); Log.w(Constants.TAG, "Error reading file: " + gpxFile.getAbsolutePath(), e);
} }
Toast.makeText(activity, activity.getString(R.string.import_error, gpxFile.getName()), activity.runOnUiThread(new Runnable() {
Toast.LENGTH_LONG).show(); @Override
public void run() {
Toast.makeText(activity, activity.getString(R.string.import_error, gpxFile.getName()),
Toast.LENGTH_LONG).show();
}
});
return false; return false;
} }