+ /**
+ * Gets the server URL according to the user preferences.
+ *
+ * @param context Context instance
+ * @param path URL path
+ * @return the server URL
+ * @throws MalformedURLException if the user preferences create an invalid URL
+ */
+ public static URL getServerURL(final Context context, final String path) throws MalformedURLException{
+ final String hostname=PreferenceManager.getDefaultSharedPreferences(context).getString("hostname", "ieval.ro");
+ final int port=Integer.parseInt(PreferenceManager.getDefaultSharedPreferences(context).getString("port", "7777"));
+ final URL url=new URL("http", hostname, port, path);
+ return url;
+ }
+