Home > Mobile >  import TextView in Android
import TextView in Android

Time:01-02

I have a problem with importing TextView it was working perfectly but suddenly it shows an error, and App is not working at all.

My project contains 4 Fragments and in one of them, there is PHP with DB connection to get some data and display it in TextView. here is my code plz look and help me to solve it.

enter image description here

and here to findviewById

enter image description here

here to get data in TextView enter image description here

and here is the XML layout example

 <TextView
                    android:id="@ id/fname"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="First Name"
                    android:textSize="28dp"
                    android:textStyle="bold" />

CodePudding user response:

In the Java file, if you point your mouse to the red lines on the right side of the editor you can import any classes missing like in this image

enter image description here

CodePudding user response:

Place this at the top of your code (After the package stuff):

import android.widget.TextView;

I only answered by how I carefully understood the question and your screenshots, if this is not what you are expecting, clarify the question.

  • Related