K
K
katavagner2015-04-30 21:45:39
Java
katavagner, 2015-04-30 21:45:39

How to make a config file in android application?

I'm used to making a separate file in PHP and including it via require_once . And how can I make a separate file in Android and connect it to any class? This file will store the constants.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
GavriKos, 2015-04-30
@katavagner

For example like this:

package com.yourpackage.name;

public class Constants {
    public static int FIRST_PARAMETER= 1;
}

Use:
Constants .FIRST_PARAMETER
Well, it is connected like any other class.

T
Tiberal, 2015-05-06
@Tiberal

SharedPreferences for configs, and you can change it freely and not be lost. It is not necessary to store all constants in one file. Keep where they are used.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question