My textview contains c++ code. As it contains special characters, i have got all other character included but when i use "\n" in my code, it enters the next line and enters remaining text to next line. How can i resolve it? Also i have included \n in start of every line because i want those lines to start from next line. here is my layout sample:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/string_display"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="
\n #include<iostream>
\n #include<conio.h>
\n #include<stdio.h>
\n void main()
\n {
\n clrscr();
\n char a[100];
\n cout<<"Enter String:";
\n cin>>a;
\n cout<<"String you entered:";
\n cout<<a;
\n getch();
\n }
\n \n
//using gets function
\n //now it will include spaces
\n
\n #include<iostream.h>
\n #include<conio.h>
\n #include<stdio.h>
\n \n void main()
\n {
\n clrscr();
\n char a[100];
\n cout<<"Enter String:";
\n gets(a);
\n cout<<"String you entered:";
\n cout<<a;
\n getch();
\n}
"
android:textSize="20sp" />
</ScrollView>
</LinearLayout>