Hi there, I am retrieving several layout's programmatically an trying to add them one to the other... I noticed I was always getting a null as a response so I actually simplified it to just retrieving one single layout, or actually it's containing View, but still to no avail :(
This is my xml layout : <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/layout_main" android:layout_height="fill_parent" android:layout_width="fill_parent" android:orientation="vertical" android:background="@drawable/mygradient"> </LinearLayout> and this is my code within the app : public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); inflater = this.getLayoutInflater(); LinearLayout main = (LinearLayout) testGenresView.this.findViewById(R.id.layout_main); //LinearLayout titleLayout = (LinearLayout)findViewById(R.layout.genre_title); //ScrollView bodyScrollView = (ScrollView)findViewById(R.layout.genre_scrollview); //genresLayout.addView(titleLayout); setContentView(main); } This line : LinearLayout main = (LinearLayout) testGenresView.this.findViewById(R.id.layout_main); will consistently return null, any idea why ??? -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en