user691285
user691285

Reputation: 401

ANDROID:How to access fragment layout objects?

I have an app that uses fragments.I'm using backward compability package with Android 2.2. I can inflate xml just fine, but problem starts when I try to access objects on the inflated layout. LogCat throws "Error inflating class fragment". What I'm doing wrong ? Here is my code :

View view001 = inflater.inflate(R.layout.bottom_right_view,container,false);
TextView text001= (TextView)getActivity().findViewById(R.id.textView1);
text001.setText("Sample text");

Upvotes: 4

Views: 2140

Answers (1)

2red13
2red13

Reputation: 11227

View view001 = inflater.inflate(R.layout.bottom_right_view,container,false);
TextView text001= (TextView)view001.findViewById(R.id.textView1);  
text001.setText("Sample text");

Upvotes: 5

Related Questions