preferenceactivity

ActivityNotFoundException (YES, this activity is declared in AndroidManifest.xml)

筅森魡賤 提交于 2019-12-03 06:20:13
I found a few threads reporting a similar problem but none of them really offers something that I haven't tried already. An innocent such call: mActivity.startActivity(new Intent(mActivity, MyEditPreferences.class)); with the following in AndroidManifest.xml: <application> <activity android:name="MyActivityLib" /> <activity android:name="com.example.baseapp.MyEditPreferences" android:label="@string/app_name"> </activity> </application> Triggers the following exception: 06-14 14:06:50.297: ERROR/AndroidRuntime(9272): android.content.ActivityNotFoundException: Unable to find explicit activity

android - How to set custom layout for PreferenceActivity in Android 3.0?

ぃ、小莉子 提交于 2019-12-03 05:11:45
I am developing app with minSdkVersion="11", that is app for tablets and Android 4.0 and newer. I have scrutinized internet on this topic, but have not found much. To implement custom layout for previous versions of Android SDK we just have to create layout (say preference.xml) with ListView and its id equals to android.R.id.list and use setContentView method. preference.xml: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" >

How do I create one Preference with an EditTextPreference and a Togglebutton?

笑着哭i 提交于 2019-12-03 02:51:42
问题 What I'm trying to implement is basically and exact replica of the image below (the preferences that I've squared). Pressing anything to the left of the preference should open up a dialog. Pressing the togglebutton will disable/enable whatever I'm setting in this preference. I've been trying for hours now and I've come up empty-handed. How do I implement this in a PreferenceActivity? EDIT: It seems people are misunderstanding my question. It is very important that I figure out how to solve my

Keep the actionbar displayed in when changing PreferenceScreen

自古美人都是妖i 提交于 2019-12-03 01:43:54
I'm trying to display a actionbar in my preference screen. In order to do so I added the following code in my SettingActivity public class PreferencesActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.preferences_activity); getFragmentManager().beginTransaction() .replace(R.id.container, new PreferencesFragment()).commit(); getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP); getSupportActionBar()

PreferenceActivity: using onSharedPreferenceChanged()

泪湿孤枕 提交于 2019-12-02 21:35:13
问题 So basically I have a PreferenceActivity that I use to make calls to a Web Service through private classes extending AsyncTask. Whenever a Preference changes I have a "huge" "switch case" determining which preference has been changed and then makes the call accordingly. Now I have two questions : This seems like a "silly" way to deal with my problem. Do you have any suggestions as to what I should do instead? I just made another set of preferences consisting of N CheckboxPreferences. How do I

Android Back Button Doesn't Return to Previous Activity

柔情痞子 提交于 2019-12-02 19:38:06
I have an app that has two activities: MainActivity and SettingsActivity. The MainActivity has a menu with a single Settings menu item. When this menu item is clicked, it launches the SettingsActivity with an intent. After the activity starts up, I click the back button in the top left corner and nothing happens. I assumed since I started the activity using an intent, the activity stack would be managed automatically. I want to return to the MainActivity. Am I wrong in this assumption? MainActivity.onMenuItemSelected public boolean onMenuItemSelected(int featureId, MenuItem item) { int itemID

How do I create one Preference with an EditTextPreference and a Togglebutton?

≡放荡痞女 提交于 2019-12-02 16:25:14
What I'm trying to implement is basically and exact replica of the image below (the preferences that I've squared). Pressing anything to the left of the preference should open up a dialog. Pressing the togglebutton will disable/enable whatever I'm setting in this preference. I've been trying for hours now and I've come up empty-handed. How do I implement this in a PreferenceActivity? EDIT: It seems people are misunderstanding my question. It is very important that I figure out how to solve my problem using a PreferenceActivity. NOT an Activity. I don't care whether I need to do it in XML or

How to set navigation drawer in preferenceActivity

拟墨画扇 提交于 2019-12-02 09:56:12
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) { getDelegate().installViewFactory(); getDelegate().onCreate(savedInstanceState); getSupportActionBar()

Proper RadioGroup in PreferenceActivity

强颜欢笑 提交于 2019-12-02 02:22:02
问题 Is it possible to define a RadioGroup in a PreferenceActivity? I could only find the ListView when offering multiple-choices. Am I missing something? 回答1: Look at API Demos App - Preferences - Preferences from XML or others examples. You can basically copy that code. There is an entry that display a list with a radio group. I don't have the code right now, but you can take a look here, it's similar: http://www.kaloer.com/android-preferences <ListPreference android:title="List Preference"

Proper RadioGroup in PreferenceActivity

六月ゝ 毕业季﹏ 提交于 2019-12-01 22:52:00
Is it possible to define a RadioGroup in a PreferenceActivity? I could only find the ListView when offering multiple-choices. Am I missing something? Look at API Demos App - Preferences - Preferences from XML or others examples. You can basically copy that code. There is an entry that display a list with a radio group. I don't have the code right now, but you can take a look here, it's similar: http://www.kaloer.com/android-preferences <ListPreference android:title="List Preference" android:summary="This preference allows to select an item in a array" android:key="listPref" android