开发者

ANDROID:How to access fragment layout objects?

开发者 https://www.devze.com 2023-02-22 07:11 出处:网络
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 inflate

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");


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

精彩评论

暂无评论...
验证码 换一张
取 消