Android examples for android.database:Cursor
get Apn Proxy Info
import android.content.Context; import android.database.Cursor; import android.net.Uri; public class Main { private static String proxyHost = ""; private static int proxyPort = 0; private static Uri PREFERRED_APN_URI = Uri.parse("content://telephony/carriers/preferapn"); public static void getApnProxyInfo(Context context) { Cursor cProxy = context.getContentResolver().query(PREFERRED_APN_URI, null, null, null, null); cProxy.moveToFirst();//www .j a va 2 s. c om if (cProxy != null && cProxy.getCount() >= 1) { String proxy = cProxy.getString(cProxy.getColumnIndex("proxy")); if (!"".equals(proxy) && proxy != null) { proxyHost = cProxy.getString(cProxy.getColumnIndex("proxy")); proxyPort = Integer.parseInt(cProxy.getString(cProxy.getColumnIndex("port"))); } else { proxyHost = ""; proxyPort = 0; } } cProxy.close(); } }