Problem with fragment findViewById

I was learning android fragments. I made a separate layout for large screens.

Now I am calling updateArticleView() from MainActivity which is actually updating the Text View inflated by the ArticleFragment. I am getting NULL by this line

 getActivity().findViewById(R.id.article);

But getView() works fine and I can update the text. I printed the view hierarchy and it has the element, but somehow findViewById of the activity cannot return the object.¬†Application is working. I posted the problem to stackoverflow. Let’s see someone can solve the catch.

Read More »

Advertisements