简体   繁体   中英

How can I convert ASCII to character in android?

I'm a self android learner. I want to convert ascii code to character. Here is the code I used.

     String s = "1000001";
     int num = Integer.parseInt(s, 2);
     TextView textView = new TextView(this);
     textView.setText(String.valueOf(num));
     setContentView(textView);

Here s is 1000001(65 in decimal) 65 is ascii value of 'A'. I want to get 'A' in my output screen.variable num has the value 65. please help me. Thanks in advance.

您可以使用此代码

Character.toString ((char) num);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM