LinearLayout findViewById problem - crash
You not loading a layout
you need to load on xml layout before using the findViewById
setContentView(R.layout.aLayout);
You have to set layout for your Activity from resources
setContentView(R.layout.my_layout);
Then you can call findViewById()
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.my_layout); // add this code
LinearLayout ln = (LinearLayout) this.findViewById(R.id.linlay);
ln.setBackgroundDrawable(getResources().getDrawable(R.drawable.wallpaper));
}
In your case you can simply set wallpaper in xml resource file by adding to LinearLayout
android:background="@drawable/wallpaper"