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

  • Home
  • SEARCH
  • 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 7874485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:48:55+00:00 2026-06-03T02:48:55+00:00

i am developing an android application that has a shared preference, containing : –

  • 0

i am developing an android application that has a shared preference, containing :
– Ringtone (done)

  • disable the dialog notification (alarm, SMS, MMS)(not yet,please read the comment inside the code)

-Tell friend (i am sure my code is right but i am not sure how to put it with Shared preference + i am now sure of place and method that i should put at it- please read to the comment inside the code)

 public class Setting extends PreferenceActivity{
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.prefs);
}
@Override
protected void onStart() {
    // TODO Auto-generated method stub
    super.onStart();
    String ringtonePreference;
    // Get the xml/preferences.xml preferences
                    SharedPreferences prefs = PreferenceManager
                                    .getDefaultSharedPreferences(getBaseContext());
     ringtonePreference = prefs.getString("ringtonePref",
                                    "DEFAULT_RINGTONE_URI");

}
  //disable all Notification (Alarm , SMS,MMS) 
     //what is the method that i should put this code at it? onStart?onDestroy?or what?
 SharedPreferences sharedPreferences = this.getPreferences(MODE_PRIVATE);
boolean hideNotification = sharedPreferences.getBoolean("checkbox", false);

if(!hideNotification)
    alertDialog.show();
}

 //tell friend
 //i am not sure if this is right place to this code
     //if it is the right place then what is the method that i should put this code at it?onStart?onActivityResult?or what?

SharedPreferences prefs1 = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
 TellFriendPreference = prefs1.getString("tellfriend","null");
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    String item = (String) getListAdapter().getItem(position);
    String str= item.toString();
    if(str=="Tell Friends"){
        Toast.makeText(this,"First", Toast.LENGTH_LONG).show();
        //Go to tell friend activity 
        //Intent i = new Intent (Help.this, .class);
        //startActivity(i);
        Intent intent = new Intent(android.content.Intent.ACTION_SEND);
        intent.setType("text/plain");
        intent.putExtra(android.content.Intent.EXTRA_TEXT, "Check out  s Application for Android. Download it today from http://s.com");  
        startActivity(Intent.createChooser(intent, "Tell friends:")); 

        startActivity(intent);




 }

this is prefs.xml

  <?xml version="1.0" encoding="utf-8"?>
  <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >

   <PreferenceCategory android:title="Second Category" >
    <RingtonePreference
        android:name="Ringtone Preference"
        android:key="ringtonePref"
        android:summary="Select a ringtone"
        android:title="Ringtones" />

    <CheckBoxPreference
        android:defaultValue="true"
        android:key="checkbox"
        android:summary="Check the Box"
        android:title="Disable Notification" />
    <Preference
         android:name="tell Preference"
         android:key="tellfriend"
        android:summary="if u want to tell ur friends by usinf"
        android:title="Tell Friend" />
     </PreferenceCategory>

   </PreferenceScreen>

please help me, i should submit it after some hours

  • 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-03T02:48:56+00:00Added an answer on June 3, 2026 at 2:48 am

    I solved my problem. I just but tell friend in another activity, my code is correct.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing an Android Application that has three very similar Activities. I would like
I'm developing application for android. my application has very big size (APKfile) that is
I'm a new android developer and developing an application that has a login screen.
We're developing an android application that has several different tabs. We've been trying to
I'm developing an Android application that has 10 different activities with the same constant
I'm currently developing an Android application that fetches images using http requests. It would
I'm currently developing an android application that uses sockets to connect to a local
I'm developing an android application that contain many custom buttons. Do I need to
I'm developing an Android 3.1 application that uses USB Host mode to communicate with
Hi an developing drawing android application. in that i want to add a sticker(image)

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.