Back to project page DroidDoesMusic.
The source code is released under:
Copyright (C) 2011 by Michael Rose, Nick Hansen, Joe Zeimen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Soft...
If you think the Android project DroidDoesMusic listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.uid.DroidDoesMusic.UI; //ww w . j a v a 2 s. c o m import android.content.pm.PackageManager; import android.os.Bundle; import android.preference.Preference; import android.preference.PreferenceActivity; import android.util.Log; import com.uid.DroidDoesMusic.R; public class Preferences extends PreferenceActivity { protected static final String TAG = "DroidDoesMusic"; @Override protected void onCreate(Bundle savedInstanceState) { Log.d(TAG, "Preferences: onCreate"); super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.settings); checkLastFm(); } public void onResume(){ super.onResume(); } public void checkLastFm() { final boolean lastFmAvailable = isLastFmInstalled(); if (!lastFmAvailable) { Preference lastfm_scrobble = findPreference("lastfm_scrobble"); lastfm_scrobble.setEnabled(false); lastfm_scrobble.setSummary(lastfm_scrobble.getSummary() + getResources().getString(R.string.lastfm_scrobble_app_required)); } } private boolean isLastFmInstalled() { PackageManager pm = getPackageManager(); boolean result = false; try { pm.getPackageInfo("fm.last.android", PackageManager.GET_ACTIVITIES); result = true; } catch (Exception e) { result = false; } return result; } }