[ Dejan tf @ 16.04.2015. 14:29 ] @
POtrebno je da uradim preuzmem iz firebird baze podatke npr. username i password, upisem te podatke u moju lokalnu bazu (SQLite), ako sam konektovan i dalje podatke cu vuci iz firebird baze, ako nemam internet da vucem podatke iz moje lokalne baze..

Ako moze mala pomoc :

Code:


public class SqlUpiti extends SQLiteOpenHelper {
    public SqlUpiti(Context applicationcontext) {
        super(applicationcontext, "user.db", null, 1);
        // TODO Auto-generated constructor stub
    }



    @Override
    public void onCreate(SQLiteDatabase db) {
        // TODO Auto-generated method stub
        String query;
        query = "CREATE TABLE users ( username INTEGER, password INTEGER)";
        db.execSQL(query);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        // TODO Auto-generated method stub
        
        String query;
        query = "DROP TABLE IF EXISTS users";
        db.execSQL(query);
        onCreate(db);
        
    }
    public void insertUser(HashMap<String, String> queryValues) {
        SQLiteDatabase database = this.getWritableDatabase();
        ContentValues values = new ContentValues();
        values.put("userId", queryValues.get("userId"));
        values.put("userName", queryValues.get("userName"));
        database.insert("users", null, values);
        database.close();
    }




Code:
public boolean logovanje() {
        // TODO Auto-generated method stub
        
        ResultSet reSet;

        String upit = "select SIFRA_RUCNI_TERMINAL  from GL_KOMERCIJALISTI where SIFRA_RUCNI_TERMINAL = ? and SIFRA_RUCNI_TERMINAL = ?   ";

        try {

            PreparedStatement pstmt = konekcija.prepareStatement(upit);
            pstmt.setString(1, edtKorisnicko.getText().toString());
            pstmt.setString(2, edtPassword.getText().toString());

            reSet = pstmt.executeQuery();
            
             

            int count = 0;

            while (reSet.next()) {

                count = count + 1;
            }

            if (count == 1) {
                Intent nasIntent = new Intent(Logovanje.this,
                        MainActivity.class);
                startActivity(nasIntent);
                edtText.setText("Korektno");

            }


Ako u metodi logovanje selektujem user i pass sada zelim te vrednosti upisati U sqlite bazu..