mardi 6 octobre 2015

pass data to three activities using intent

I have three activities and the flow should like Information>>workForce>>workDetailsTable. I pass the data by using intent. However, when I see the data stored in SQLite, I only able to see the values saved in WorkForce table. I getting NULL value in Information table. Why would this happen? It is only able to pass the data to two activities only?

Information

 button.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Intent intent = new Intent(context, WorkForce.class);
                a = spinner.getSelectedItem().toString();
                intent.putExtra("a",a);
                startActivity(intent);
            }
        });

WorkForce

button.setOnClickListener
                (
                        new View.OnClickListener() {
                        public void onClick(View v) {
                        Intent intent = new Intent(context, WorkDetailsTable.class);
                         subCon=txt1.getText().toString();
                         startActivity(intent);


                            }
                        }
                );

WorkDetailsTable

 final String name=getIntent().getExtras().getString("a");
 final String subContractors=getIntent().getExtras().getString("subCon");
Button btn1=(Button)findViewById(R.id.button2);
        btn1.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {

                ts.insertTimeSheet(name);
                WF.insertWorkForce(subContractors);

Aucun commentaire:

Enregistrer un commentaire