Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does it shuts down when I click onClick event?
    text
    copied!<p>I did put <code>android:clickable="true"</code>, and <code>android:onClick="iconViewLink4"</code> in <code>LinearLayout</code></p> <p>So, <code>iconViewLink4</code> should be called when it's clicked.<br> However, this application shuts down when I click it. </p> <p>What's wrong with this code?</p> <p><strong>Layout(activity_behind_left_simple.xml)</strong></p> <pre><code>&lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android" style="@style/leftBehindMenuScroll" &gt; &lt;LinearLayout style="@style/behindMenuScrollContent" android:paddingTop="25dp" &gt; &lt;TextView style="@style/behindMenuItemTitle" android:text="People" /&gt; &lt;View android:layout_width="fill_parent" android:layout_height="1dp" android:layout_marginBottom= "5dp" android:background="#d2d2d2"/&gt; &lt;LinearLayout android:id="@+id/iconViewLink4" android:layout_width="match_parent" android:clickable="true" android:onClick="iconViewLink4" android:layout_height="wrap_content" &gt; &lt;jp.fureco.IconView android:id="@+id/iconViewItem4" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="15dp" android:textSize="20dp"/&gt; &lt;TextView android:layout_marginLeft="10dp" style="@style/behindMenuItemLabel" android:text="visitor" /&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; &lt;/ScrollView&gt; </code></pre> <p><strong>MainActivity.java</strong></p> <pre><code>public class MainActivity extends Activity { ... @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mNav = new SimpleSideDrawer(this); mNav.setLeftBehindContentView(R.layout.activity_behind_left_simple); mNav.setRightBehindContentView(R.layout.activity_behind_right_simple); ... } public void iconViewLink4(View view) { Toast.makeText(this, "This is test!", Toast.LENGTH_SHORT).show(); } } </code></pre> <p><strong>LogCat</strong></p> <pre><code>08-13 06:12:53.278: E/Trace(26398): error opening trace file: No such file or directory (2) 08-13 06:12:53.648: E/chromium(26398): external/chromium/net/disk_cache/stat_hub.cc:216: [0813/061253:ERROR:stat_hub.cc(216)] StatHub::Init - App com.sample isn't supported. 08-13 06:12:53.658: E/chromium(26398): external/chromium/net/disk_cache/stat_hub.cc:216: [0813/061253:ERROR:stat_hub.cc(216)] StatHub::Init - App com.sample isn't supported. 08-13 06:12:59.664: E/GLUtils(26398): GL ERROR - after deleteUnusedTextures() glError (0x502) 08-13 06:13:00.585: E/AndroidRuntime(26398): FATAL EXCEPTION: main 08-13 06:13:00.585: E/AndroidRuntime(26398): java.lang.IllegalStateException: Could not find a method iconViewLink4(View) in the activity class android.app.Application for onClick handler on view class android.widget.LinearLayout with id 'iconViewLink4' 08-13 06:13:00.585: E/AndroidRuntime(26398): at android.view.View$1.onClick(View.java:3596) 08-13 06:13:00.585: E/AndroidRuntime(26398): at android.view.View.performClick(View.java:4102) 08-13 06:13:00.585: E/AndroidRuntime(26398): at android.view.View$PerformClick.run(View.java:17085) 08-13 06:13:00.585: E/AndroidRuntime(26398): at android.os.Handler.handleCallback(Handler.java:615) 08-13 06:13:00.585: E/AndroidRuntime(26398): at android.os.Handler.dispatchMessage(Handler.java:92) 08-13 06:13:00.585: E/AndroidRuntime(26398): at android.os.Looper.loop(Looper.java:155) 08-13 06:13:00.585: E/AndroidRuntime(26398): at android.app.ActivityThread.main(ActivityThread.java:5511) 08-13 06:13:00.585: E/AndroidRuntime(26398): at java.lang.reflect.Method.invokeNative(Native Method) 08-13 06:13:00.585: E/AndroidRuntime(26398): at java.lang.reflect.Method.invoke(Method.java:511) 08-13 06:13:00.585: E/AndroidRuntime(26398): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1029) 08-13 06:13:00.585: E/AndroidRuntime(26398): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:796) 08-13 06:13:00.585: E/AndroidRuntime(26398): at dalvik.system.NativeStart.main(Native Method) 08-13 06:13:00.585: E/AndroidRuntime(26398): Caused by: java.lang.NoSuchMethodException: iconViewLink4 [class android.view.View] 08-13 06:13:00.585: E/AndroidRuntime(26398): at java.lang.Class.getConstructorOrMethod(Class.java:460) 08-13 06:13:00.585: E/AndroidRuntime(26398): at java.lang.Class.getMethod(Class.java:915) 08-13 06:13:00.585: E/AndroidRuntime(26398): at android.view.View$1.onClick(View.java:3589) 08-13 06:13:00.585: E/AndroidRuntime(26398): ... 11 more </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload