Example usage for android.os Build MODEL

List of usage examples for android.os Build MODEL

Introduction

In this page you can find the example usage for android.os Build MODEL.

Prototype

String MODEL

To view the source code for android.os Build MODEL.

Click Source Link

Document

The end-user-visible name for the end product.

Usage

From source file:com.doomonafireball.hackerswiperfree.android.activity.MainActivity.java

@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    int typerIndex = savedInstanceState.getInt(TYPER_INDEX);

    if (mTyper == null) {
        mTyper = new Typer(this);
    }/*from   w  ww  .j  ava  2s  .c  o  m*/

    mTyper.setIndex(typerIndex);

    text.setText("");
    text.append("@" + Build.MODEL.replaceAll("\\s+", "").toLowerCase().trim() + ": ");
    text.append(mTyper.getTextPortion(typerIndex));

}

From source file:com.appaholics.email.mail.store.ImapStoreUnitTests.java

/**
 * Setup code.  We generate a lightweight ImapStore and ImapStore.ImapFolder.
 *//*from  w w w  . j  a v  a  2  s.c  o m*/
@Override
protected void setUp() throws Exception {
    super.setUp();
    Context realContext = getInstrumentation().getTargetContext();
    ImapStore.sImapId = ImapStore.makeCommonImapId(realContext.getPackageName(), Build.VERSION.RELEASE,
            Build.VERSION.CODENAME, Build.MODEL, Build.ID, Build.MANUFACTURER, "FakeNetworkOperator");
    mTestContext = new SecondaryMockContext(
            DBTestHelper.ProviderContextSetupHelper.getProviderContext(realContext), realContext);
    MockVendorPolicy.inject(mTestContext);

    TempDirectory.setTempDirectory(mTestContext);

    // These are needed so we can get at the inner classes
    HostAuth testAuth = new HostAuth();
    Account testAccount = new Account();

    testAuth.setLogin("user", "password");
    testAuth.setConnection("imap", "server", 999);
    testAccount.mHostAuthRecv = testAuth;
    mStore = (ImapStore) ImapStore.newInstance(testAccount, mTestContext);
    mFolder = (ImapFolder) mStore.getFolder(FOLDER_NAME);
    resetTag();
}

From source file:com.inter.trade.ui.fragment.buylicensekey.BuyLicenseKeyModifyFragment.java

/**
 * ?????  BuyLicenseKeyDetailFragment//from w w w  .  ja va  2 s  . c  o  m
 */
private boolean checkModify() {
    String paycardid = BuyLicenseKeyMainFragment.licenseKey;
    if (TextUtils.isEmpty(paycardid)) {
        PromptUtil.showToast(getActivity(), "??");
        return false;
    }

    /**
     * modifyFlag 0 
     */
    if (modifyFlag == 0) {
        String deviceModel = BuyLicenseKeyMainFragment.deviceModel;
        String deviceId = BuyLicenseKeyMainFragment.deviceId;
        //         if(!TextUtils.isEmpty(deviceModel) && !TextUtils.isEmpty(deviceId)){
        if (!TextUtils.isEmpty(deviceId)) {
            return true;
        } else {
            PromptUtil.showToast(getActivity(), "IMEI");
            return false;
        }
    }

    /**
     * modifyFlag 1 
     */
    if (modifyFlag == 1) {
        String deviceModel = Build.MODEL;
        String deviceId = PhoneInfoUtil.getNativePhoneDeviceId(getActivity());
        //         if(!TextUtils.isEmpty(deviceModel) && !TextUtils.isEmpty(deviceId)){
        if (!TextUtils.isEmpty(deviceId)) {
            BuyLicenseKeyMainFragment.deviceModel = deviceModel;
            BuyLicenseKeyMainFragment.deviceId = deviceId;
            return true;
        } else {
            PromptUtil.showToast(getActivity(), "?IMEI?");
            return false;
        }
    }

    return false;
}

From source file:com.example.snapcacheexample.PickerActivity.java

@Override
protected void onStart() {
    super.onStart();
    if (FRIEND_PICKER.equals(getIntent().getData())) {
        try {/*from  ww w.j a v  a2  s.  c  o  m*/
            friendPickerFragment.loadData(false);
        } catch (Exception ex) {
            onError(ex);
        }
    } else if (PLACE_PICKER.equals(getIntent().getData())) {
        try {
            Location location = null;
            Criteria criteria = new Criteria();
            LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
            String bestProvider = locationManager.getBestProvider(criteria, false);
            if (bestProvider != null) {
                location = locationManager.getLastKnownLocation(bestProvider);
                if (locationManager.isProviderEnabled(bestProvider) && locationListener == null) {
                    locationListener = new LocationListener() {
                        @Override
                        public void onLocationChanged(Location location) {
                            float distance = location.distanceTo(placePickerFragment.getLocation());
                            if (distance >= LOCATION_CHANGE_THRESHOLD) {
                                placePickerFragment.setLocation(location);
                                placePickerFragment.loadData(true);
                            }
                        }

                        @Override
                        public void onStatusChanged(String s, int i, Bundle bundle) {
                        }

                        @Override
                        public void onProviderEnabled(String s) {
                        }

                        @Override
                        public void onProviderDisabled(String s) {
                        }
                    };
                    locationManager.requestLocationUpdates(bestProvider, 1, LOCATION_CHANGE_THRESHOLD,
                            locationListener, Looper.getMainLooper());
                }
            }
            if (location == null) {
                String model = Build.MODEL;
                if (model.equals("sdk") || model.equals("google_sdk") || model.contains("x86")) {
                    // this may be the emulator, pretend we're in an exotic place
                    location = SAN_FRANCISCO_LOCATION;
                }
            }
            if (location != null) {
                placePickerFragment.setLocation(location);
                placePickerFragment.setRadiusInMeters(SEARCH_RADIUS_METERS);
                placePickerFragment.setSearchText(SEARCH_TEXT);
                placePickerFragment.setResultsLimit(SEARCH_RESULT_LIMIT);
                placePickerFragment.loadData(false);
            } else {
                onError(getResources().getString(R.string.no_location_error), true);
            }
        } catch (Exception ex) {
            onError(ex);
        }
    }
}

From source file:edu.tjhsst.ion.gcmFrame.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    this.setContentView(R.layout.activity_main);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(getResources().getColor(R.color.navbar_color));

    }/*w w w  .  ja v a  2 s .co  m*/
    // requestWindowFeature(Window.FEATURE_NO_TITLE);

    mRegistrationBroadcastReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
            boolean sentToken = sharedPreferences.getBoolean(QuickstartPreferences.SENT_TOKEN_TO_SERVER, false);
            if (sentToken) {
                Log.i(TAG, "Google token sent");

            } else {
                Toast.makeText(getApplicationContext(), getString(R.string.token_error_message),
                        Toast.LENGTH_LONG).show();
            }
        }

    };

    if (checkPlayServices()) {
        // Start IntentService to register this application with GCM.
        Intent intent = new Intent(this, RegistrationIntentService.class);
        startService(intent);
    }

    ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(
            Context.CONNECTIVITY_SERVICE);
    if (connectivityManager != null) {
        NetworkInfo ni = connectivityManager.getActiveNetworkInfo();
        if (ni != null) {
            NetworkInfo.State state = ni.getState();
            if (state == null || state != NetworkInfo.State.CONNECTED) {
                // record the fact that there is no connection
                isConnected = false;
            }
        }
    }

    SharedPreferences sharedPreferences = PreferenceManager
            .getDefaultSharedPreferences(getApplicationContext());
    boolean sentToken = sharedPreferences.getBoolean(QuickstartPreferences.ION_SETUP, false);

    webView = (WebView) findViewById(R.id.webview);

    webView.setInitialScale(1);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setLoadWithOverviewMode(true);

    webView.getSettings().setUseWideViewPort(true);
    webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
    webView.setScrollbarFadingEnabled(false);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        WebView.setWebContentsDebuggingEnabled(true);
    }
    StringBuilder uaString = new StringBuilder(webView.getSettings().getUserAgentString());
    uaString.append(" - IonAndroid: gcmFrame (");
    if (sentToken) {
        uaString.append("appRegistered:True");
    } else {
        uaString.append("appRegistered:False");
    }
    uaString.append(" osVersion:").append(System.getProperty("os.version"));
    uaString.append(" apiLevel:").append(android.os.Build.VERSION.SDK_INT);
    uaString.append(" Device:").append(android.os.Build.DEVICE);
    uaString.append(" Model:").append(android.os.Build.MODEL);
    uaString.append(" Product:").append(android.os.Build.PRODUCT);
    uaString.append(")");
    webView.getSettings().setUserAgentString(uaString.toString());

    webView.setNetworkAvailable(isConnected);

    webView.addJavascriptInterface(new WebAppInterface(this), "IonAndroidInterface");

    webView.loadUrl(MainActivity.ION_HOST);

    webView.setWebViewClient(new WebViewClient() {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            Log.d(TAG, "Loading " + url);
            if (!isConnected) {
                String html = getHtml("offline.html");
                html = html.replaceAll("\\[url\\]", url);
                view.loadData(html, "text/html", "utf-8");
                return true;
            } else if (url.contains(ION_HOST)) {
                // keep in WebView
                webView.loadUrl(url);
                return true;
            } else {
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(Uri.parse(url));
                startActivity(intent);
                return true;
            }
        }

        @Override
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
            // if (errorCode == ERROR_TIMEOUT)
            view.stopLoading(); // may not be needed
            String html = getHtml("timeout.html");
            html = html.replaceAll("\\[url\\]", failingUrl);
            html = html.replaceAll("\\[desc\\]", description);
            view.loadData(html, "text/html", "utf-8");
        }
    });

}

From source file:org.chaos.fx.cnbeta.preferences.PreferencesFragment.java

private void composeEmail(String address, String subject) {
    Intent intent = new Intent(Intent.ACTION_SENDTO);
    intent.setData(Uri.parse("mailto:")); // only email apps should handle this
    intent.putExtra(Intent.EXTRA_EMAIL, new String[] { address });
    intent.putExtra(Intent.EXTRA_SUBJECT, subject);
    intent.putExtra(Intent.EXTRA_TEXT, "\n\n\n\nApp Version" + BuildConfig.VERSION_NAME
            + "\nAndroid Version: " + Build.VERSION.RELEASE + "\nDevice Model: " + Build.MODEL);
    if (intent.resolveActivity(getActivity().getPackageManager()) != null) {
        startActivity(intent);//from  w ww. j  av a 2s .  c  om
    }
}

From source file:im.vector.util.BugReporter.java

/**
 * Send a bug report./*from   ww  w  .j a v a2  s .c o m*/
 *
 * @param context         the application context
 * @param withDevicesLogs true to include the device logs
 * @param withCrashLogs   true to include the crash logs
 */
private static void sendBugReport(final Context context, final boolean withDevicesLogs,
        final boolean withCrashLogs, final String bugDescription, final IMXBugReportListener listener) {
    new AsyncTask<Void, Integer, String>() {
        @Override
        protected String doInBackground(Void... voids) {
            File bugReportFile = new File(context.getApplicationContext().getFilesDir(), "bug_report");

            if (bugReportFile.exists()) {
                bugReportFile.delete();
            }

            String serverError = null;
            FileWriter fileWriter = null;

            try {
                fileWriter = new FileWriter(bugReportFile);
                JsonWriter jsonWriter = new JsonWriter(fileWriter);
                jsonWriter.beginObject();

                // android bug report
                jsonWriter.name("user_agent").value("Android");

                // logs list
                jsonWriter.name("logs");
                jsonWriter.beginArray();

                // the logs are optional
                if (withDevicesLogs) {
                    List<File> files = org.matrix.androidsdk.util.Log.addLogFiles(new ArrayList<File>());
                    for (File f : files) {
                        if (!mIsCancelled) {
                            jsonWriter.beginObject();
                            jsonWriter.name("lines").value(convertStreamToString(f));
                            jsonWriter.endObject();
                            jsonWriter.flush();
                        }
                    }
                }

                if (!mIsCancelled && (withCrashLogs || withDevicesLogs)) {
                    jsonWriter.beginObject();
                    jsonWriter.name("lines").value(getLogCatError());
                    jsonWriter.endObject();
                    jsonWriter.flush();
                }

                jsonWriter.endArray();

                jsonWriter.name("text").value(bugDescription);

                String version = "";

                if (null != Matrix.getInstance(context).getDefaultSession()) {
                    version += "User : " + Matrix.getInstance(context).getDefaultSession().getMyUserId() + "\n";
                }

                version += "Phone : " + Build.MODEL.trim() + " (" + Build.VERSION.INCREMENTAL + " "
                        + Build.VERSION.RELEASE + " " + Build.VERSION.CODENAME + ")\n";
                version += "Vector version: " + Matrix.getInstance(context).getVersion(true) + "\n";
                version += "SDK version:  " + Matrix.getInstance(context).getDefaultSession().getVersion(true)
                        + "\n";
                version += "Olm version:  "
                        + Matrix.getInstance(context).getDefaultSession().getCryptoVersion(context, true)
                        + "\n";

                jsonWriter.name("version").value(version);

                jsonWriter.endObject();
                jsonWriter.close();

            } catch (Exception e) {
                Log.e(LOG_TAG, "doInBackground ; failed to collect the bug report data " + e.getMessage());
                serverError = e.getLocalizedMessage();
            } catch (OutOfMemoryError oom) {
                Log.e(LOG_TAG, "doInBackground ; failed to collect the bug report data " + oom.getMessage());
                serverError = oom.getMessage();

                if (TextUtils.isEmpty(serverError)) {
                    serverError = "Out of memory";
                }
            }

            try {
                if (null != fileWriter) {
                    fileWriter.close();
                }
            } catch (Exception e) {
                Log.e(LOG_TAG, "doInBackground ; failed to close fileWriter " + e.getMessage());
            }

            if (TextUtils.isEmpty(serverError) && !mIsCancelled) {

                // the screenshot is defined here
                // File screenFile = new File(VectorApp.mLogsDirectoryFile, "screenshot.jpg");
                InputStream inputStream = null;
                HttpURLConnection conn = null;
                try {
                    inputStream = new FileInputStream(bugReportFile);
                    final int dataLen = inputStream.available();

                    // should never happen
                    if (0 == dataLen) {
                        return "No data";
                    }

                    URL url = new URL(context.getResources().getString(R.string.bug_report_url));
                    conn = (HttpURLConnection) url.openConnection();
                    conn.setDoInput(true);
                    conn.setDoOutput(true);
                    conn.setUseCaches(false);
                    conn.setRequestMethod("POST");
                    conn.setRequestProperty("Content-Type", "application/json");
                    conn.setRequestProperty("Content-Length", Integer.toString(dataLen));
                    // avoid caching data before really sending them.
                    conn.setFixedLengthStreamingMode(inputStream.available());

                    conn.connect();

                    DataOutputStream dos = new DataOutputStream(conn.getOutputStream());

                    byte[] buffer = new byte[8192];

                    // read file and write it into form...
                    int bytesRead;
                    int totalWritten = 0;

                    while (!mIsCancelled && (bytesRead = inputStream.read(buffer, 0, buffer.length)) > 0) {
                        dos.write(buffer, 0, bytesRead);
                        totalWritten += bytesRead;
                        publishProgress(totalWritten * 100 / dataLen);
                    }

                    dos.flush();
                    dos.close();

                    int mResponseCode;

                    try {
                        // Read the SERVER RESPONSE
                        mResponseCode = conn.getResponseCode();
                    } catch (EOFException eofEx) {
                        mResponseCode = HttpURLConnection.HTTP_INTERNAL_ERROR;
                    }

                    // if the upload failed, try to retrieve the reason
                    if (mResponseCode != HttpURLConnection.HTTP_OK) {
                        serverError = null;
                        InputStream is = conn.getErrorStream();

                        if (null != is) {
                            int ch;
                            StringBuilder b = new StringBuilder();
                            while ((ch = is.read()) != -1) {
                                b.append((char) ch);
                            }
                            serverError = b.toString();
                            is.close();

                            // check if the error message
                            try {
                                JSONObject responseJSON = new JSONObject(serverError);
                                serverError = responseJSON.getString("error");
                            } catch (JSONException e) {
                                Log.e(LOG_TAG, "doInBackground ; Json conversion failed " + e.getMessage());
                            }

                            // should never happen
                            if (null == serverError) {
                                serverError = "Failed with error " + mResponseCode;
                            }

                            is.close();
                        }
                    }
                } catch (Exception e) {
                    Log.e(LOG_TAG,
                            "doInBackground ; failed with error " + e.getClass() + " - " + e.getMessage());
                    serverError = e.getLocalizedMessage();

                    if (TextUtils.isEmpty(serverError)) {
                        serverError = "Failed to upload";
                    }
                } catch (OutOfMemoryError oom) {
                    Log.e(LOG_TAG, "doInBackground ; failed to send the bug report " + oom.getMessage());
                    serverError = oom.getLocalizedMessage();

                    if (TextUtils.isEmpty(serverError)) {
                        serverError = "Out ouf memory";
                    }

                } finally {
                    try {
                        if (null != conn) {
                            conn.disconnect();
                        }
                    } catch (Exception e2) {
                        Log.e(LOG_TAG, "doInBackground : conn.disconnect() failed " + e2.getMessage());
                    }
                }

                if (null != inputStream) {
                    try {
                        inputStream.close();
                    } catch (Exception e) {
                        Log.e(LOG_TAG, "doInBackground ; failed to close the inputStream " + e.getMessage());
                    }
                }
            }
            return serverError;
        }

        @Override
        protected void onProgressUpdate(Integer... progress) {
            super.onProgressUpdate(progress);

            if (null != listener) {
                try {
                    listener.onProgress((null == progress) ? 0 : progress[0]);
                } catch (Exception e) {
                    Log.e(LOG_TAG, "## onProgress() : failed " + e.getMessage());
                }
            }
        }

        @Override
        protected void onPostExecute(String reason) {
            if (null != listener) {
                try {
                    if (mIsCancelled) {
                        listener.onUploadCancelled();
                    } else if (null == reason) {
                        listener.onUploadSucceed();
                    } else {
                        listener.onUploadFailed(reason);
                    }
                } catch (Exception e) {
                    Log.e(LOG_TAG, "## onPostExecute() : failed " + e.getMessage());
                }
            }
        }
    }.execute();
}

From source file:com.silentcircle.silenttext.util.DeviceUtils.java

public static JSONObject getDebugInformationJSON(Context context) {

    try {/*from   w  w  w. ja v a2 s  .c om*/

        JSONObject json = new JSONObject();

        json.put("timestamp", JSONUtils.getDate(System.currentTimeMillis()));

        JSONObject android = new JSONObject();

        android.put("version", Build.VERSION.RELEASE);
        android.put("api", Build.VERSION.SDK_INT);
        android.put("build", Build.FINGERPRINT);

        json.put("android", android);

        JSONObject application = new JSONObject();

        try {

            PackageInfo pinfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);

            application.put("version_name", pinfo.versionName);
            application.put("version_code", pinfo.versionCode);
            setInstallAndUpdateTimes(pinfo, application);

        } catch (NameNotFoundException impossible) {
            throw new RuntimeException(impossible);
        }

        json.put("application", application);

        JSONObject device = new JSONObject();

        Configuration resourceConfiguration = context.getResources().getConfiguration();

        device.put("locale", resourceConfiguration.locale);
        device.put("orientation",
                resourceConfiguration.orientation == Configuration.ORIENTATION_LANDSCAPE ? "landscape"
                        : "portrait");
        device.put("density", getScreenDensity(resourceConfiguration));
        device.put("screen", getScreenDimensions(resourceConfiguration));

        device.put("manufacturer", Build.MANUFACTURER);
        device.put("model", Build.MODEL);

        JSONObject encryption = new JSONObject();

        encryption.put("supported", isFullDiskEncryptionSupported(context));
        encryption.put("enabled", isEncrypted(context));

        device.put("encryption", encryption);

        json.put("device", device);

        JSONObject build = new JSONObject();

        build.put("date", context.getString(R.string.build_date));
        build.put("version", context.getString(R.string.build_version));
        build.put("commit", context.getString(R.string.build_commit));

        json.put("build", build);

        JSONObject connection = new JSONObject();

        SilentTextApplication global = SilentTextApplication.from(context);

        XMPPTransport client = global.getXMPPTransport();

        JSONObject xmpp = new JSONObject();

        xmpp.put("status", global.getXMPPTransportConnectionStatus());

        if (client != null) {

            boolean online = client.isConnected();

            xmpp.put("online", online);

            if (online) {
                xmpp.put("host", client.getServerHost());
                xmpp.put("port", client.getServerPort());
            }

        }

        connection.put("xmpp", xmpp);

        json.put("connection", connection);

        ServiceConfiguration serviceConfig = ServiceConfiguration.getInstance();

        JSONObject services = new JSONObject();

        services.put("debug", serviceConfig.debug);
        services.put("experimental", serviceConfig.experimental);
        services.put("logging_enabled", serviceConfig.loggingEnabled);
        services.put("environment", serviceConfig.environment);
        services.put("dns.use_custom_server", serviceConfig.useCustomDNS);
        if (serviceConfig.useCustomDNS) {
            services.put("dns.custom_server", serviceConfig.customDNS);
        }
        services.put("validate_certificates", serviceConfig.shouldValidateCertificates);
        services.put("api.override", serviceConfig.api.override);
        services.put("api.perform_srv_lookup", serviceConfig.api.performSRVLookup);
        services.put("api.host", serviceConfig.api.host);
        services.put("api.port", serviceConfig.api.port);
        services.put("api.service_name", serviceConfig.api.serviceName);
        services.put("feature.check_user_availability", serviceConfig.features.checkUserAvailability);
        services.put("feature.generate_default_avatars", serviceConfig.features.generateDefaultAvatars);
        services.put("gcm.sender_id", serviceConfig.gcm.senderID);
        services.put("gcm.target", serviceConfig.gcm.target);
        services.put("scimp.enable_pki", serviceConfig.scimp.enablePKI);
        services.put("scloud.url", serviceConfig.scloud.url);
        services.put("xmpp.override", serviceConfig.xmpp.override);
        services.put("xmpp.perform_srv_lookup", serviceConfig.xmpp.performSRVLookup);
        services.put("xmpp.host", serviceConfig.xmpp.host);
        services.put("xmpp.port", serviceConfig.xmpp.port);
        services.put("xmpp.service_name", serviceConfig.xmpp.serviceName);
        services.put("xmpp.background", serviceConfig.xmpp.background);
        services.put("passcode_set", !OptionsDrawer.isEmptyPasscode(context));
        services.put("silent_contacts_v1", SilentContactRepositoryV1.supports(context));
        services.put("silent_contacts_v2", SilentContactRepositoryV2.supports(context));
        services.put("silent_phone", SilentPhone.supports(context));

        json.put("configuration", services);

        return json;

    } catch (JSONException impossible) {
        throw new RuntimeException(impossible);
    }

}

From source file:com.cc.signalinfo.fragments.SignalFragment.java

/**
 * Set the phone model, OS version, carrier name on the screen
 *///w  w w . j ava2s .c om
private void setPhoneInfo() {
    setTextViewText(R.id.deviceName, String.format("%s %s", Build.MANUFACTURER, Build.MODEL));
    setTextViewText(R.id.deviceModel, String.format("%s/%s (%s) ", Build.PRODUCT, Build.DEVICE, Build.ID));
    setTextViewText(R.id.androidVersion, String.format(activity.getString(R.string.androidVersion),
            Build.VERSION.RELEASE, Build.VERSION.SDK_INT));

    setTextViewText(R.id.carrierName, tm.getNetworkOperatorName());
    setTextViewText(R.id.buildHost, Build.HOST);
    setNetworkTypeText();
}

From source file:com.landenlabs.all_devtool.ScreenFragment.java

void updateView() {
    m_displayMetrics = Utils.getDisplayMetrics(m_context);

    m_layout = Ui.viewById(m_rootView, R.id.screen_layout);
    m_screenDevice = Ui.viewById(m_rootView, R.id.screen_device);

    TextView screenSizeText = Ui.viewById(m_rootView, R.id.screen_size);
    TextView screenDensityText = Ui.viewById(m_rootView, R.id.screen_density);

    m_screenDevice.setText(Build.MODEL);
    int widthPx = m_displayMetrics.widthPixels;
    int heightPx = m_displayMetrics.heightPixels;
    String sizeStr = String.format(Locale.getDefault(), "%.0f dp x %.0f dp\n%d px x %d px\n%.1f in x %.1f in",
            Utils.pxToDp(widthPx), Utils.pxToDp(heightPx), widthPx, heightPx,
            (float) widthPx / m_displayMetrics.densityDpi, (float) heightPx / m_displayMetrics.densityDpi);
    screenSizeText.setText(sizeStr);/*  w  ww  .j ava  2 s  .c om*/

    String densityStr = "Low";
    if (m_displayMetrics.densityDpi <= DisplayMetrics.DENSITY_MEDIUM)
        densityStr = "Medium";
    else if (m_displayMetrics.densityDpi <= DisplayMetrics.DENSITY_HIGH)
        densityStr = "High";
    else if (m_displayMetrics.densityDpi <= DisplayMetrics.DENSITY_XHIGH)
        densityStr = "x-High";
    else if (m_displayMetrics.densityDpi <= DisplayMetrics.DENSITY_XXHIGH)
        densityStr = "xx-High";
    else if (m_displayMetrics.densityDpi > DisplayMetrics.DENSITY_XXHIGH)
        densityStr = "xxx-High";

    screenDensityText.setText(String.format("Density %s(%d) px/dp=%.2f", densityStr,
            m_displayMetrics.densityDpi, m_displayMetrics.density));

    m_horzWindowArrow = Ui.viewById(m_rootView, R.id.horz_arrow);
    m_vertPanelArrow = Ui.viewById(m_rootView, R.id.vert_panel_arrow);

    m_horzWindowText = Ui.viewById(m_rootView, R.id.horz_arrow_text);
    m_vertPanelText = Ui.viewById(m_rootView, R.id.vert_panel_text);

    TextView themeTv = Ui.viewById(m_rootView, R.id.theme);
    // themeTv.setRotation(-90);
    String themeName = GlobalInfo.s_globalInfo.themeName;
    if (!themeName.equals("Theme.Holo"))
        themeName = themeName + "\nBest with Theme.Halo";
    themeTv.setText(themeName);

    /*
     * Dynamically get theme - always returns 'AppTheme' which is set in style
    try {
        PackageInfo packageInfo = getActivity().getPackageManager().getPackageInfo(GlobalInfo.s_globalInfo.pkgName, 0);
         int themeResId = packageInfo.applicationInfo.theme;
         String themeName = getResources().getResourceEntryName(themeResId);
         themeTv.setText(themeName);
    } catch (Exception ex) {
        themeTv.setVisibility(View.GONE);
    }
    */

    Message msgObj = m_handler.obtainMessage(MSG_GET_UI_SIZE);
    m_handler.sendMessageDelayed(msgObj, 1000);

    final TextView touchPos = Ui.viewById(m_rootView, R.id.touch_pos);
    m_drawPoints = Ui.viewById(m_rootView, R.id.drawPoints);
    m_drawPoints.setOnTouchInfo(new DrawView.TouchInfo() {
        public void onTouchInfo(MotionEvent event) {
            touchPos.setText(String.format("%.0f,%.0f", event.getX(), event.getY()));
        }
    });
}