Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding preferences makes my app fail
    primarykey
    data
    text
    <p>I just added preferences to my app and it fails to open (i.e shows a black screen or stops unexpectedly). By commenting out some lines, I found out that the problem was in the initialization of the preferences.</p> <pre><code>//some imports here public class MyApp extends Activity { ..... SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); ...... } </code></pre> <p>Once I comment out that line, everything (except preferences) works well. Logcat showed me some errors (like 20) but now it isn't showing errors but the app still doesn't load.</p> <p>EDIT: This is the preferences.xml (under xml folder) </p> <pre><code>&lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;ListPreference android:key="format" android:title="Saving Format" android:summary="Select the file format" android:defaultValue="jpg" android:entries="@array/format" android:entryValues="@array/formatValues" /&gt; &lt;/PreferenceScreen&gt; </code></pre> <p>And here is the array.xml under layout folder </p> <pre><code>&lt;resources&gt; &lt;string-array name="format"&gt; &lt;item name="jpg"&gt;JPEG&lt;/item&gt; &lt;item name="gif"&gt;GIF&lt;/item&gt; &lt;/string-array&gt; &lt;string-array name="formatValues"&gt; &lt;item name="jpg"&gt;.jpg&lt;/item&gt; &lt;item name="gif"&gt;.gif&lt;/item&gt; &lt;/string-array&gt; &lt;/resources&gt; </code></pre> <p>Ironic how I cant manage to make logcat give me Errors now. It just does not load. If I remove that single line (SharedPreferences....) it works normally.</p> <p>Any ideas what might be wrong?</p> <p>Thanks!</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.
    1. This table or related slice is empty.
    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