littlewombat littlewombat - 1 year ago 91
Java Question

Clickable LinearLayout in android studio

I want to use LinearLayot as a button, actually I have:

LinearLayout Ll;
Ll = (LinearLayout) findViewById(;
Ll.setOnClickListener(new View.OnClickListener(){
public void onClick(View view) {

but it doesn't work, when I try to open this activity is warning "Unfortunately, app has stopped". Click should close activity and back to main, in "//action" I use "finish()" but there is the same problem.


If you look at your code.

You are calling


after the linearlayout binding with click listener.

move these as the first line of the OnCreate