MihaiDamian:
I have the fallowing problem: my Grid is null. I dont know why i have this problem :( I have the fallowing structure :
Activity Courses :
layout="@layout/app_bar_courses"
android:id="@+id/app_bar_coursesID"
android:layout_width="match_parent"
android:layout_height="match_parent" />
app bar courses
android:id="@+id/content_coursesID"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
/>
and final layout content courses ( just the start of it )
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/mainGrid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_alignParentBottom="true"
android:alignmentMode="alignMargins"
android:columnCount="1"
android:columnOrderPreserved="false"
android:padding="14dp"
android:rowCount="3"
>
The code in courses java file
View myLayout=findViewById(R.id.app_bar_coursesID);
View mySecondLayout=myLayout.findViewById(R.id.content_coursesID);
GridView grid;
String web[]={"TV"};
int[] tvid ={};
CourseCustomAdapter adapter = new CourseCustomAdapter(Courses.this, web, tvid);
//TODO:why grid is null
grid=(GridView)mySecondLayout.findViewById(R.id.mainGrid);
grid.setAdapter(adapter);
Ty in advance, hope this isnt a repost :D
Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots