Search code examples
androidmobilesettingsandroid-4.2-jelly-bean

Android: How to limit an app's UI to its "Settings" dialogue?


I am new to Android development.

I'd like to create an Android application whose only UI area is the Settings area of the application itself. Is it possible to create such an application, where any kind of "main" view is forgone and the user is instead directed straight to the "settings" area?

If so, how would one go about starting the user directly in the "settings" area upon the launch of the application?


Solution

  • You make declare the main activity as being your Settings Activity. Android doesn't care which Activity is the main one, as long as it has one.

    This is what part of your manifest should look like

    <activity android:name=".SettingsActivityName" android:label="@string/title_activity_settings">
    <intent-filter>
    <action android:name="android.intent.action.MAIN"/>
    <category android:name="android.intent.category.LAUNCHER"/>
    </intent-filter>
    </activity>
    

    This tells Android what Activity is the one to launch when the user taps on your application icon.