Questions tagged [preferenceactivity]

PreferenceActivity in Android is a base class for an activity to show a hierarchy of preferences to the user

680 questions
8
votes
2 answers

How to add a "long click listener" to a Preference?

I have an PreferenceActivity where I would like to add Preferences dynamically. On a long click, these shall do something, however OnPreferenceClickListener only supports normal clicks, no long clicks. Is there a way to implement this feature, did I…
Force
  • 6,312
  • 7
  • 54
  • 85
8
votes
3 answers

Start activity from preference-headers

I'm implementing n-layer PreferenceActivities 1st layer PreferenceActivity is loaded from preference-headers. First header creates fragment of settings which is a PreferenceFragment. Second is a browser activity (2nd is an example from…
8
votes
6 answers

Android: Unable to find explicit activity class... startActivity from a PreferenceActivity

I'm trying to start a new Activity from a PreferenceActivity. However, it fails with "Unable to find explicit activity class. Have you declared this activity in your AndroidManifest.xml?" Well, yeah, I declared it:
danieleds
  • 669
  • 1
  • 6
  • 17
8
votes
10 answers

ListView item won't stay "selected"

I want to change the background of a listview item when the user clicks it. Kind of like the Honeycomb settings page (Although I'm not dealing with just settings so I'm not using PreferenceActivity) I have this functionality working through a…
yellavon
  • 2,821
  • 12
  • 52
  • 66
8
votes
3 answers

How to show app version on Preferences Activity?

Id like to add an my app version and possibly build on the my SettingsActivity. Im trying to show an "About Phone" style activity on my app. But I dont know how to go about it. I am currently using EditTextPreference in my preference.xml which calls…
user3137329
8
votes
5 answers

Is there a way to keep the dividers around a non selectable preference?

If you set the selectability of a preference item to false, you will notice that the dividers around that item will disappear. Do you know if there is a way to keep those dividers? I have looked at the ListView API and could not find a solution that…
8
votes
1 answer

NullPointerException at android.widget.ArrayAdapter.createViewFromResource

I am creating a application with preference activity where the listpreference entries are problematically assigned. This application works fine on my emulator but while i test my application in mobile it shows error like this FATAL EXCEPTION:…
8
votes
4 answers

Change Preference Screen background color

I change color PreferenceScreen with this code.But how get Preference Screen in main Preference activity and change Preference Screen color ??? getListView().setBackgroundColor(Color.TRANSPARENT); …
D.D.M.
  • 117
  • 1
  • 1
  • 9
8
votes
4 answers

Compatibility for SwitchPreference (pre ICS)?

Is the SwitchPreference introduced in ICS compatible in the android-support-v4 library? I'm trying to update some old projects and would like to use SwitchPreferences if possible. I know I can make a separate resource file to distinguish the API…
SD_Guru
  • 339
  • 3
  • 10
7
votes
3 answers

Dynamically changing android preference's widgetlayout resource

I created a preference entry inside preference screen, which looks like this: Here I…
kkgery
  • 431
  • 6
  • 13
7
votes
2 answers

Preferences of varying height within a PreferenceActivity

I have a custom class that extends Preference that I'm using in conjunction with a PreferenceActivity. When I try to adjust the height in the layout my Preference is using (with a static layout_height or with wrap_content) it is always displayed in…
Nick
  • 8,483
  • 10
  • 46
  • 65
7
votes
3 answers

Setting preference layout and changing the attribute in it

is it possible to access programmatically a layout which is set to a Preference? Here is what I have, a very simple project - proof of concept The Preference Activity: package com.example; import android.os.Bundle; import…
Nik Chankov
  • 6,049
  • 1
  • 20
  • 30
7
votes
2 answers

Preferences without deprecated methods

I'm trying to (correctly) implement a preferences screen, but the problem is that all the methods used to read preferences from xml files are deprecated (or I just don't recognize them). The official sample code on the dev site (PreferenceActivity)…
SBoss
  • 8,845
  • 7
  • 28
  • 44
7
votes
2 answers

Change PreferenceActivity text color

I want to change the look of my Android app's preference screen to dark text color. How can I do this? (I´ve already changed the background to white color)
guilherme.minglini
  • 564
  • 2
  • 6
  • 20
7
votes
1 answer

How to make SharedPreferences from a PreferenceActivity be set to default in Android?

I have created a PreferenceActivity based on xml for PreferenceScreen. In the xml you can assign default values to the different preferences. But these are not stored in my SharedPreferences before the screen is opened and closed. The problem is…
Gober
  • 3,632
  • 3
  • 26
  • 33