Skip to content

Instantly share code, notes, and snippets.

@p4yam
Last active February 12, 2017 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save p4yam/5deb60d29fe9427725bd5e0838ee2f48 to your computer and use it in GitHub Desktop.
Save p4yam/5deb60d29fe9427725bd5e0838ee2f48 to your computer and use it in GitHub Desktop.
get android hardware info
package ir.kivee.androidsysteminfo;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = (Button)findViewById(R.id.getSystemInfo);
final TextView textView = (TextView)findViewById(R.id.info_display);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
textView.setText(
"SERIAL: " + Build.SERIAL + "\n" +
"MODEL: " + Build.MODEL + "\n" +
"ID: " + Build.ID + "\n" +
"Manufacture: " + Build.MANUFACTURER + "\n" +
"Brand: " + Build.BRAND + "\n" +
"Type: " + Build.TYPE + "\n" +
"User: " + Build.USER + "\n" +
"BASE: " + Build.VERSION_CODES.BASE + "\n" +
"INCREMENTAL: " + Build.VERSION.INCREMENTAL + "\n" +
"SDK: " + Build.VERSION.SDK + "\n" +
"BOARD: " + Build.BOARD + "\n" +
"BRAND: " + Build.BRAND + "\n" +
"HOST: " + Build.HOST + "\n" +
"FINGERPRINT: "+Build.FINGERPRINT + "\n" +
"Version Code: " + Build.VERSION.RELEASE
);
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment