1

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.

madhan kumar
  • 1,560
  • 2
  • 26
  • 36
hari s g
  • 53
  • 2
  • 13
  • Please see below link http://stackoverflow.com/questions/4211705/binary-to-text-in-java – avil Mar 30 '16 at 06:37
  • Possible duplicate of [How to convert ASCII code (0-255) to a String of the associated character?](http://stackoverflow.com/questions/7693994/how-to-convert-ascii-code-0-255-to-a-string-of-the-associated-character) – Rohit Arya Mar 30 '16 at 07:26

1 Answers1

6

You can use this code

Character.toString ((char) num);
Adnan Amjad
  • 2,553
  • 1
  • 20
  • 29
  • if i'm giving like this ..It does not work.. String s = "100"; int num = Integer.parseInt(s, 2); plz suggest a method to work both cases(charater and number) – hari s g Mar 30 '16 at 15:34