get samsung Device Name - Android Hardware

Android examples for Hardware:Device Name

Description

get samsung Device Name

Demo Code


//package com.java2s;

import android.os.Build;
import java.util.HashMap;

public class Main {
    private static HashMap<String, String> humanReadableNames = new HashMap<String, String>();

    public static String getDeviceName() {

        String dictName = humanReadableNames.get(Build.MODEL.replace(' ',
                '_'));
        if (dictName != null)
            return dictName;

        if (Build.BRAND.equals("samsung") || Build.BRAND.equals("Samsung")) {
            return "Samsung" + Build.MODEL;
        }//from ww  w. jav  a  2 s.c  o  m

        return Build.MODEL;

    }
}

Related Tutorials