Gostaria de saber se seria possível preencher uma TextView com o conteúdo de um arquivo PHP.
Não me refiro a visualização como em um WebView, gostaria de exibir o código com todas as tags:
Meu código até agora: res/layout/activity_php.xml
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@color/colorPrimaryDark" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:orientation="horizontal" >
<Button
android:id="@+id/btn_back"
android:layout_width="40dp"
android:layout_height="match_parent"
android:background="@drawable/ic_back" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAlignment="center"
android:text="@string/title_php"
android:gravity="center_vertical"
android:textSize="20dp"
android:textColor="@color/colorAccent" />
</LinearLayout>
<RelativeLayout
android:id="@+id/view_php"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="30dp"
android:layout_marginBottom="30dp" >
<TextView
android:id="@+id/view_php_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="AQUI EU GOSTARIA DE EXIBIR O CONTEÚDO DO ARQUIVO PHP!" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_alignParentBottom="true" >
<Button
android:id="@+id/btn_php"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_centerInParent="true"
android:text="Show content"
android:textColor="@color/colorPrimaryDark"
android:background="@color/colorAccent"
android:textSize="8dp" />
</RelativeLayout>
</RelativeLayout>
`
java/projectName/functions/PhpActivity
package com.packageName.projectName;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class PhpActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_php);
Button btnBack = findViewById(R.id.btn_back);
btnBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent closeView = new Intent(PhpActivity.this, MainActivity.class);
startActivity(closeView);
finish();
}
});
Button btnPHP = findViewById(R.id.btn_php);
btnPHP.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// AQUI GOSTARIA DE UM TRIGER PARA MONTAR A ESTRUTURA NO TEXT VIEW SE FOR POSSÍVEL
Toast.makeText(TestaActivity.this, "Recieving", Toast.LENGTH_LONG).show();
}
});
}
}