Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Android
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Tim Cooke
Paul Clapham
Liutauras Vilda
Sheriffs:
Junilu Lacar
Rob Spoor
Jeanne Boyarsky
Saloon Keepers:
Stephan van Hulst
Carey Brown
Tim Holloway
Piet Souris
Bartenders:
Forum:
Android
NullPointerException in inflating layout
Astha Sharma
Ranch Hand
Posts: 250
I like...
posted 9 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hello,
I'm getting NullPointerException in my code when I'm inflating layout.
This is my
java
code-
LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View convertView = layoutInflater.inflate(R.layout.grouped_text_view, this); itemsContainer = (LinearLayout) convertView.findViewById(R.id.items_container); itemsContainer.setVisibility(View.GONE); //line 1
grouped_text_view.xml-
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" style="@style/GroupedTextViewContainer"> <LinearLayout android:id="@+id/items_container" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/item_background" android:orientation="vertical"> </LinearLayout> </LinearLayout>
This throws NullPointerException in line 1. Please tell me what can be the reason.
Astha - OCPJP 6 (90%)
This is my favorite show. And this is my favorite tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Reusable Layout
ArrayList says false in emulator
how to add main two button to my screen
Put a Linear Layout
reading XML layout contains a SurfaceView
More...