I'm creating a text view in android studio, the text view is empty by default, it fetches data from mysql database. The text is long and contains the "\n" character for force line breaks. For some reason, the text view is displaying the \n and there isn't any line breaks. Here is my code:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:singleLine="false"
android:id="@+id/textView"
android:layout_centerHorizontal="true"
android:gravity="center"
android:textAlignment="center"
android:layout_below="@+id/imageView3"
android:layout_marginTop="70dp"
android:textColor="#ffffff"
android:textSize="35sp"
/>
here is the picture of the app showing text with no line break :( https://goo.gl/Cr34Cq
the text in picture is edited in mysql database. it is displayed as it is.
i can also provide java code and mysql database table also.
here is java code that fetches data from mysql database.
public class Main extends AppCompatActivity {
//phpconnection declaration
TextView resultView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
//phpconnection starts from here
StrictMode.enableDefaults();
resultView = (TextView) findViewById(R.id.textView);
getData();
---------------------debug -------------------------------
'Waiting for device. Target device: motorola-xt1033 Uploading file local path: C:\Users\Admin\AndroidStudioProjects\BabyNames(Balochi)\app\build\outputs\apk\app-debug.apk remote path: /data/local/tmp/com.balochibabynames.doradevelopers.babynamesbalochi Installing com.balochibabynames.doradevelopers.babynamesbalochi DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.balochibabynames.doradevelopers.babynamesbalochi" pkg: /data/local/tmp/com.balochibabynames.doradevelopers.babynamesbalochi Success
Launching application: com.balochibabynames.doradevelopers.babynamesbalochi/com.balochibabynames.doradevelopers.babynamesbalochi.Splash. DEVICE SHELL COMMAND: am start -D -n "com.balochibabynames.doradevelopers.babynamesbalochi/com.balochibabynames.doradevelopers.babynamesbalochi.Splash" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.balochibabynames.doradevelopers.babynamesbalochi/.Splash }
Waiting for process: com.balochibabynames.doradevelopers.babynamesbalochi Connected to the target VM, address: 'localhost:8600', transport: 'socket''