Now I know these are fairly common issues, but I'm using a textview that cannot be resolved. I've cleaned the project, import android.widget.TextView, but it continues to flag as unresolved.
This is the code I'm using:
public void onStart() {
super.onStart();
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet("http://1.php");
HttpResponse response = client.execute(request);
// Get the response
BufferedReader rd = new BufferedReader
(new InputStreamReader(response.getEntity().getContent()));
String line = "";
while ((line = rd.readLine()) != null) {
TextView.append(line);
}
}
TextView in activity_main:
<TextView
android:id="@+id/TextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10">
</TextView>
Any ideas on this please?
EDIT:
TextView textView = (TextView) findViewById(R.id.TextView1);
String line = "";
while ((line = rd.readLine()) != null) {
TextView1.append(line);
}
The end line starting with TextView1 is providing the error stating it cannot be resolved. Just the TextView1
though, not the entire line.
EDIT 28/10/2012:
Ok, so the TextView is now working, but in turn, other parts of the code are not. This is a screenshot showing exactly what. I can wrap each of these in a try and catch statement but then the app force closes on my Android device.
http://southwestdesign.org.uk/Code.jpg
Any ideas on this one please?
I was having the same issue. The problem was that I created a project first and then I didn't completed it. So I created a second project. Texview was Texview2 instead and editText was editText2. You might need to update textView to textView2. Hope this helps.
Did you import textview?
import android.widget.TextView;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With