encode portal title for gmaps url

This commit is contained in:
Philipp Schaefer 2013-08-01 00:52:28 +02:00
parent 3e541c3acd
commit 8a9f595373

View File

@ -14,6 +14,8 @@ import android.view.MenuItem;
import com.cradle.iitc_mobile.R; import com.cradle.iitc_mobile.R;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.DecimalFormatSymbols; import java.text.DecimalFormatSymbols;
import java.util.ArrayList; import java.util.ArrayList;
@ -77,7 +79,12 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList
// thx to gmaps, this only works for the decimal point separator // thx to gmaps, this only works for the decimal point separator
String gMapsUri; String gMapsUri;
if (decFormat.getDecimalSeparator() == '.') if (decFormat.getDecimalSeparator() == '.')
gMapsUri = "http://maps.google.com/maps?q=loc:" + mLl + "%20(" + mTitle + ")&z=" + mZoom; try {
gMapsUri = "http://maps.google.com/maps?q=loc:" + mLl + "%20(" + URLEncoder.encode(mTitle, "UTF-8") + ")&z=" + mZoom;
} catch (UnsupportedEncodingException e) {
gMapsUri = "http://maps.google.com/maps?ll=" + mLl + "&z=" + mZoom;
e.printStackTrace();
}
else else
gMapsUri = "http://maps.google.com/maps?ll=" + mLl + "&z=" + mZoom; gMapsUri = "http://maps.google.com/maps?ll=" + mLl + "&z=" + mZoom;
Intent gMapsIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(gMapsUri)); Intent gMapsIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(gMapsUri));