when i am fetching the string of formatted code from Firebase Realtime database the code showing in a single line.
mRAJENDRAKUMAR-droid opened this issue · comments
mRAJENDRAKUMAR-droid commented
###DetailActivity.xml
``
<TextView
android:id="@+id/textViewrv1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:text="program name sample as login to firebase"
android:layout_centerHorizontal="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!-- CODEVIEW program-->
<RelativeLayout
android:layout_below="@+id/textViewrv1"
android:layout_width="match_parent"
android:layout_marginTop="10dp"
android:orientation="vertical"
android:layout_height="match_parent">
<io.github.kbiakov.codeview.CodeView
android:id="@+id/code_view_text"
android:layout_width="match_parent"
android:layout_height="match_parent"></io.github.kbiakov.codeview.CodeView>
</RelativeLayout>
DetailActivity.java
package com.rajendra.firebaseproject.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import com.rajendra.firebaseproject.R;
import io.github.kbiakov.codeview.CodeView;
import io.github.kbiakov.codeview.adapters.Options;
import io.github.kbiakov.codeview.classifier.CodeProcessor;
import io.github.kbiakov.codeview.highlight.ColorTheme;
public class DetailActivity extends AppCompatActivity {
String pname,pcontent;
TextView rvpname;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
pname = getIntent().getExtras().getString("sendPNAME");
pcontent = getIntent().getExtras().getString("sendPCONTENT");
rvpname =findViewById(R.id.textViewrv1);
rvpname.setText(pname);
CodeProcessor.init(this);
CodeView codeView = (CodeView) findViewById(R.id.code_view_text);
//codeView.setCode(pcontent, "c");
codeView.setOptions(Options.Default.get(this)
.withLanguage("c")
.withCode(pcontent)
.withTheme(ColorTheme.MONOKAI));
}
}
but the ans is showing like this screenshots :
DatLag commented
Add linebreaks (\n) to your code
mRAJENDRAKUMAR-droid commented
Ya it works but \n converting to \\n
…Sent from my iPad
Rajendra Kumar Majhi
Mob no : 9777497783
On 10-Jul-2019, at 14:38, DATL4G ***@***.***> wrote:
Add linebreaks (\n) to your code
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
DatLag commented
Thats made by firebase just change it to \n again
DatLag commented