preferenceactivity

Starting custom PreferenceActivity INSIDE another PreferenceActivity

淺唱寂寞╮ 提交于 2019-12-24 00:33:54
问题 Inside my Configuration activity i need to create a preference screen with a fixed View at the top showing a preview of content configured in the page. I don't want to change the main preference screen (i have already a separate activity for that) i want a different layout for a "nested" preferencescreen. What i've tried is specifying an Intent inside the preference screen however when i click on this options nothing happens and activity goes into timeout... Activity is correctly configured

Can't get onSharedPreferenceChanged() to work

拈花ヽ惹草 提交于 2019-12-23 19:24:51
问题 I wanna display a dialog when the user selects a specific item from a ListPreference in my preferenceActivity. But, I cannot get the onSharedPreferenceChanged() to work. I've put a Toast in the beginning of the method, and it does not show, so the method doesn't even run through, why is this? Here's my code: (Thanks) public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Toast.makeText(Preferences.this, "prefs Changed", Toast.LENGTH_SHORT) .show(); if (key

Use getSupportFragmentManager() Inside PreferenceActivity

Deadly 提交于 2019-12-23 10:18:11
问题 I have my custom ConfigActivity which extends PreferenceActivity (from android.preference.PreferenceActivity ). The layout for this activity contains a <ListView android:id="@android:id/list"... . Inside this layout, I need to programmatically add/replace a couple of other Fragments I have created that extend android.support.v4.app.Fragment . However, Eclipse says: The method getSupportFragmentManager() is undefined for the type ConfigActivity . I tried replacing it for just

How can I permanently store a value from a preference screen?

萝らか妹 提交于 2019-12-23 03:37:11
问题 I am a newbie in Android and I'm just trying to permanently store a string. I want to get this string from a PreferenceActivity and then update the text of a TextView . I was reading about the available options for persistent storage: http://developer.android.com/guide/topics/data/data-storage.html#pref I've tried to use SharedPreferences but it's very unclear for me on how it should work. I have created a very simple test app. MainActivity.java public class MainActivity extends Activity { /*

Launch Intent from account-authenticator accountPreferences screen?

一世执手 提交于 2019-12-23 02:32:21
问题 I have included the AccountManager code in my app to enable the user to create and manage their account from inside their Settings application. I linked in the "accountPreferences" preferences file inside my account-authenticator definition, and the options show properly in the Settings > Accounts > My App screen. When I tap on one of them, instead of getting the activity I linked in, I get: 01-14 14:47:27.304: ERROR/AndroidRuntime(27708): FATAL EXCEPTION: main android.util

Android PreferenceActivity to create a MODE_WORLD_WRITEABLE preference across applications

不打扰是莪最后的温柔 提交于 2019-12-22 11:07:44
问题 I have multiple applications that share certain data through preferences. Each app sets its preferences through a PreferenceActitivity (from xml). Two questions: How do I use/edit preferences created by one app in another app. If I figure out how to create MODE_WORLD_WRITEABLE preferences using PreferenceActivity that will solve the problem. SharedPreferences prefs = getSharedPreferences( <String referring to another package´s prefs>, MODE_WORLD_WRITEABLE); HashMap<String, String> map =

Android - Headers categories in PreferenceActivity with PreferenceFragment

微笑、不失礼 提交于 2019-12-21 01:45:33
问题 I would like to display a preference screen like the one in the Android settings app : using headers, PreferenceActivity, PreferenceFragment and headers categories. I wan't this result on a tablet : And this one on a smartphone : It works if I just use the basic headers, but if I try to add categories, it works on the smartphone, and crash on the tablet, where I get the exception "java.lang.NullPointerException: name == null" : FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start

How to set navigation drawer in preferenceActivity

半腔热情 提交于 2019-12-20 06:41:14
问题 In my app i have each activity with drawer, but when i set drawer in my Preference activity, my activity working fine, but drawer not appear. here is my code.. public class SettingActivity extends PreferenceActivity implements NavigationView.OnNavigationItemSelectedListener { private AppCompatDelegate mDelegate; private NavigationView mDrawer; private DrawerLayout mDrawerLayout; private ActionBarDrawerToggle mDrawerToggle; @Override public void onCreate(Bundle savedInstanceState) {

getActionBar().setDisplayHomeAsUpEnabled(true); nullpointer in preferenceActivity

假装没事ソ 提交于 2019-12-19 09:58:29
问题 I searched a lot for this issue, but didn't found nothing relevant . I' updated my app project to use api 21, now when i run preferenceactivity i get a nullpointer on that row. This is my code (it's the same code provided from eclipse when creating a new settingsactivity). package com.example.prova; import android.annotation.TargetApi; import android.content.Context; import android.content.res.Configuration; import android.media.Ringtone; import android.media.RingtoneManager; import android

Using PreferenceScreen with applicationIdSuffix

天涯浪子 提交于 2019-12-19 08:17:32
问题 I'm having some problems making PreferenceScreen and applicationIdSuffix work together. Supposing my app package/ applicationId is com.myapp in Gradle and in AndroidManifest.xml, and applicationIdSuffix is defined as: buildTypes { debug { applicationIdSuffix '.dev' } } If I define a PreferenceScreen as the following <PreferenceScreen android:key="key_about" android:summary="something" android:title="About"> <intent android:targetClass="com.myapp.activities.AboutActivity" android:targetPackage