如上面的标题.我想从一个十六进制数字EditText
EditText number = (EditText) findViewById (R.id.etDisplay);
Editable stringEditable = number.getText().toString;
String nuovo = stringEditable.toString();
Run Code Online (Sandbox Code Playgroud)
我想转换nuovo为decimal number.
pix*_*xel 28
int i = Integer.parseInt(nuovo, 16);
Run Code Online (Sandbox Code Playgroud)
接受的答案在某些情况下有效,但如果您的数字可能大于Integer.MAX_VALUE,您可能需要使用以下内容:
public static long hexToLong(String hex) {
return Long.parseLong(hex, 16);
}
Run Code Online (Sandbox Code Playgroud)