Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8205087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:06:23+00:00 2026-06-07T08:06:23+00:00

I have some problem with my android project! I have created a preferences intent

  • 0

I have some problem with my android project! I have created a preferences intent and it works fine in the emulator. but when I transfer the project and launch the preferences through the menu key of the mobile, it stops working and closes! I want to know what is going on with it!

My device is : Xperia Mini Pro –> Running Android ICS 4.0.4

the code is,

Preference class :

package com.sliit.droidman.main;

import com.sliit.droidman.R;

import android.os.Bundle;
import android.preference.PreferenceActivity;

public class Prefs extends PreferenceActivity{

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.prefs);
}
}

Preference xml file :

 <?xml version="1.0" encoding="utf-8"?>
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
 <EditTextPreference
    android:title="Edit text"
    android:key="name"
    android:summary="enter your name"
 ></EditTextPreference>
 <CheckBoxPreference
    android:title="Music"
    android:defaultValue="true"
    android:key="checkbox"
    android:summary="check this box"
 ></CheckBoxPreference>
 <ListPreference
    android:title="list"
    android:key="list"
    android:summary="this is a list to choose from"
    android:entries="@array/list"
    android:entryValues="@array/lValues"
 ></ListPreference>
 </PreferenceScreen>

Place where the preferences is called into action :

 SharedPreferences getprefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
    boolean music = getprefs.getBoolean("checkbox", true);
    if (music == true) {
        splashmp3.start();
    }

what Am I doing wrong here! I dont have any issue with the emulator! but the problem exists with the device! As I had a previous application developed in the same manner, I ran it in the device and it worked fine on the preferences. but this force closes. Do I have to give any permissions! O.o

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T08:06:24+00:00Added an answer on June 7, 2026 at 8:06 am

    I found out what was giving the error. it was an error where I create the prefs intent in a switch case. 🙂 I have mistyped the class name. so I corrected it and now it works like magic!

      switch (item.getItemId()) {
        case R.id.about:
            startActivity(new Intent(this, About.class));
            break;
        case R.id.prefs:
            Intent prefs = new Intent("com.cdap.droidman.PREFS");
            startActivity(prefs);
            break;
        case R.id.exit:
            finish();
            break;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with R in android. I have a project with some
I have created some aidl files for IPC in my Android project. They compile
I have a weird problem with the Android emulator. I have created a virtual
I have an Android project completely fine, then I created a separate workspace and
I have some problem with Android AsyncTask. There is an Activity which contains some
I have some problem with displaying emoji icon in Android TextView First, I found
i am having a small problem with my android application. I have some mp3
I have a strange problem with opengl es(Android) .Some textures doesn't drawing correct ,its
In my android application I have created 2 projects. The main project and a
I need some help with properly versioning my Android project with Git/Eclipse. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.