0

I am new to Android. Not sure what is going wrong.. What I am trying to do is inflate a textView which is available in MainActivity into a different class (non activity). I am actually not getting any error but it simply does not show the text that is shown below after execution. Any suggestion will definitely be appreciated.

protected void onPreExecute(){

    LayoutInflater inflater = (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE);
    View row = inflater.inflate(R.layout.activity_main,null,false);
    TextView textView = (TextView) row.findViewById(R.id.textView1);
    textView.setText("you great really!");

}
Andrew Brooke
  • 12,073
  • 8
  • 39
  • 55
subha
  • 11
  • 2
  • hi, kindly put more code, i recommend that you attach your full code – penta Oct 03 '15 at 17:52
  • hii @subha , to access the textView of main activity you can get the reference like this and update the text. textView = (TextView) ((MainActivity)context).findViewById(R.id.textView1); – Awadesh Oct 03 '15 at 17:57

1 Answers1

0
textView.invalidate();

after setText();

or if not happened allready of course adding it to the view heirarchy respectiyely to the layout view you are using for content in activity

Ilja KO
  • 1,272
  • 12
  • 26