Android Open Source - notes Utils

From Project

Back to project page notes.


The source code is released under:

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2004 Sam Hocevar <> Everyone is permitted to copy and distribute verbatim or...

If you think the Android project notes listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.iliakplv.notes.utils;
/*w ww .j  a va2 s.  c  o  m*/
import android.content.Context;
import android.os.Build;

import com.iliakplv.notes.NotesApplication;
import com.iliakplv.notes.R;

public final class Utils {
  private Utils() {
    throw new AssertionError("Instance creation not allowed!");

  public static String getVersionName() {
    try {
      final Context context = NotesApplication.getContext();
      return context.getPackageManager()
          .getPackageInfo(context.getPackageName(), 0).versionName;
    } catch (PackageManager.NameNotFoundException e) {"About", "Can't get app version", e);
      return "1";

  public static String getDeviceInformation() {
    return "Version: " + getVersionName() +
        "\n" + "Translation: " + NotesApplication.getContext().getString(R.string.translation) +
        "\n" + "Device: " + Build.MANUFACTURER + " " + Build.MODEL +
        "\n" + "API level: " + Build.VERSION.SDK_INT;

Java Source Code List