Accessing TextView from another class
Posted
by
Jenny
on Stack Overflow
See other posts from Stack Overflow
or by Jenny
Published on 2011-01-05T19:49:49Z
Indexed on
2011/01/05
20:53 UTC
Read the original article
Hit count: 155
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
© Stack Overflow or respective owner