mercredi 30 septembre 2015

How to save different data from different class to different database?

Is it possible to save the data from different classes and then save them into different database by one click?

Information.java

 protected void onCreate(Bundle savedInstanceState) {
        Button button=(Button)findViewById(R.id.button6);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.information);
        txtDate = (EditText) findViewById(R.id.editText5);
        String date=txtDate.getText().toString();
        button.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Intent intent = new Intent(context, WorkForce.class);
                startActivity(intent);
            }
        });
}

WorkForce.java

txtDate1 = (EditText) findViewById(R.id.editText6);
 Button btnSaved=(Button)findViewById(R.id.button5);
        btnSaved.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                String date=txtDate1.getText().toString();
             ts.insertTimeSheet(date);  //data from class Information
              s1.insertData(date1);

            }
        });

Aucun commentaire:

Enregistrer un commentaire