Variable visibility in SQLiteOpenHelper android

why in all demos and tutorials in SQLiteOpenHelper class variables always: public static final

Take a look:

    public static final String ORDER_ID = "order_id";
    public static final String ORDER_LOGIN_NAME = "login_name";
    public static final String ORDER_RESTO_U_NAME = "resto_uniqe_name";

My question is: I am making an application and its database is too large. Thus, I will have to make up at least 60-70 variables of this kind. Will this affect application performance? Since these are static variables.

Any help would be greatly appreciated ....

+4
source share
2 answers

final , since the value of the variable cannot be changed, further change cannot be changed or changed

public final static String, String, ( , ).

1) , . . - - .

2) , . , .

, , , , . ! public static final String ORDER_ID = "order_id"; , !

+3

, public private package - , final static - Android-, : http://developer.android.com/training/articles/perf-tips.html#UseFinal

:

static int intVal = 42;
static String strVal = "Hello, world!";

, , . 42 intVal strVal. , .

"final":

static final int intVal = 42;
static final String strVal = "Hello, world!";

, dex. , intVal, 42, strVal " " .

+3

Source: https://habr.com/ru/post/1532791/


All Articles