How to Create Dynamic Spinner in Java

Asked

Viewed 87 times

1

Hello, I have a question about how to create three interdependent dynamic spinners, ie create a first spinner called "Module", from the selected value the spinner "Sub module" display only the items related to it and from the value of the "Sub module" display the "Function" spinner items for the selected sub-module. It would be the same problem to select the item of a Spinner called "State" and the Spinner "City" display only the cities of the selected state. The structure of the three tables in the database is as follows:

CREATE TABLE ANDROID_MODULO(
    ID_MODULO INTEGER PRIMARY KEY AUTOINCREMENT, 
    NMODULO VARCHAR(50)
);

CREATE TABLE ANDROID_SUBMODULO(
    ID_SUBMODULO INTEGER PRIMARY KEY AUTOINCREMENT, 
    ID_MODULO INT NOT NULL 
       REFERENCES ANDROID_MODULO 
       ON DELETE NO ACTION ON UPDATE NO ACTION,
    NSUBMODULO VARCHAR(50)
);

CREATE TABLE ANDROID_FUNCOES(
    ID_FUNCAO INTEGER PRIMARY KEY AUTOINCREMENT, 
    ID_MODULO INT NOT NULL 
        REFERENCES ANDROID_MODULO(ID_MODULO) 
        ON DELETE NO ACTION ON UPDATE NO ACTION,
    ID_SUBMODULO INT NOT NULL 
        REFERENCES ANDROID_SUBMODULO (ID_SUBMODULO) 
        ON DELETE NO ACTION ON UPDATE NO ACTION,
    NFUNCAO  VARCHAR(60)
);

I am able to bring the value of the module and write its id in the table of Calls, but in the display of sub modules and functions I am not able to load the data correctly, I thank you.

  • Take a look at this question: http://stackoverflow.com/questions/11564891/android-dynamic-spinner

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.