Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.ContentValues;

import android.database.sqlite.SQLiteDatabase;

public class Main {
    private static void insertDepartment(SQLiteDatabase db, String name, double coordinateX, double coordinateY,
            String city, String address, String[] telephoneNumbers, String workingHours) {
        ContentValues valuesDepartment = new ContentValues();
        valuesDepartment.put("NAME", name);
        valuesDepartment.put("COORDINATE_X", coordinateX);
        valuesDepartment.put("COORDINATE_Y", coordinateY);
        valuesDepartment.put("CITY", city);
        valuesDepartment.put("ADDRESS", address);
        valuesDepartment.put("WORKING_HOURS", workingHours);
        long idInsertedDepartment = db.insert("DEPARTMENT", null, valuesDepartment);
        for (String number : telephoneNumbers) {
            ContentValues valuesNumbers = new ContentValues();
            valuesNumbers.put("DEPARTMENT_ID", idInsertedDepartment);
            valuesNumbers.put("TELEPHONE", number);
            db.insert("TELEPHONE", null, valuesNumbers);
        }
    }
}