Back to project page tracks-android.
The source code is released under:
Copyright (c) 2010 Adam Wolfe Gordon <awg@xvx.ca> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to...
If you think the Android project tracks-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package ca.xvx.tracks.preferences; /*from w ww. j a v a 2 s . c o m*/ import android.content.SharedPreferences; import java.net.URI; import java.net.URISyntaxException; public class PreferenceUtils { public static URI getUri(SharedPreferences prefs, String file) throws URISyntaxException { String server = prefs.getString(PreferenceConstants.SERVER, null); final boolean https = prefs.getBoolean(PreferenceConstants.HTTPS, false); final boolean badcert = prefs.getBoolean(PreferenceConstants.BADCERT, false); final int port; if(https) { port = Integer.parseInt(prefs.getString(PreferenceConstants.PORT, "443")); } else { port = Integer.parseInt(prefs.getString(PreferenceConstants.PORT, "80")); } final String protocol = https ? "https" : "http"; final String[] spl = server.split("/", 2); final String path; if(spl.length > 1) { server = spl[0]; path = "/" + spl[1] + "/"; } else { path = "/"; } return new URI(protocol, null, server, port, path + file, null, null); } }