Note that there are some explanatory texts on larger screens.

plurals
  1. POApp force closes after opening WiFi settings
    primarykey
    data
    text
    <p>I want my app to open WiFi settings on button click but when I do so, it force closes. This is my code:</p> <pre><code>public class Settings extends Activity { private static Intent ACTION_WIFI_SETTINGS; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.settings, menu); return true; } public void click(View view) { Intent intent = new Intent(Settings.ACTION_WIFI_SETTINGS); startActivity(intent); } } </code></pre> <p>The XML Layout:</p> <pre><code> &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".Settings" &gt; &lt;RadioGroup android:id="@+id/radioGroup1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginTop="14dp" &gt; &lt;/RadioGroup&gt; &lt;RadioButton android:id="@+id/radio0" android:onClick="togglewifi" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:checked="true" android:text="Toggle Wifi" /&gt; &lt;RadioButton android:id="@+id/radio1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/radio0" android:text="Toggle Data" /&gt; &lt;Button android:onClick="click" style="?android:attr/buttonStyleSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/radio1" android:layout_below="@+id/radio1" android:layout_marginTop="16dp" android:text="Configure" /&gt; &lt;Button android:id="@+id/button2" style="?android:attr/buttonStyleSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:text="Done" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>LogCat:</p> <pre><code>12-22 12:29:36.429: E/AndroidRuntime(2813): FATAL EXCEPTION: main 12-22 12:29:36.429: E/AndroidRuntime(2813): java.lang.IllegalStateException: Could not execute method of the activity 12-22 12:29:36.429: E/AndroidRuntime(2813): at android.view.View$1.onClick(View.java:2144) 12-22 12:29:36.429: E/AndroidRuntime(2813): at android.view.View.performClick(View.java:2485) 12-22 12:29:36.429: E/AndroidRuntime(2813): at android.view.View$PerformClick.run(View.java:9080) 12-22 12:29:36.429: E/AndroidRuntime(2813): at android.os.Handler.handleCallback(Handler.java:587) 12-22 12:29:36.429: E/AndroidRuntime(2813): at android.os.Handler.dispatchMessage(Handler.java:92) </code></pre> <p>How can I fix this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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