Wednesday, January 5, 2011

Accessing TextView from another class

Programmer Question

I've got my main startup class loading main.xml but I'm trying to figure out how to access the TextView from another class which is loading information from a database. I would like to publish that information to the TextView.



So far I've not found any helpful examples on Google.



EDIT:
This is my class that is doing the Database work:



import android.widget.TextView;import android.view.View; 
public class DBWork{
private View view;
...
TextView tv = (TextView) view.findViewById(R.id.TextView01);
tv.setText("TEXT ME")


Yet, everytime I do that I get a nullpointerexception



Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails