{"id":23870112,"url":"https://github.com/engineermichael/-vehicle-management-app-android-studios-","last_synced_at":"2026-05-19T07:04:11.202Z","repository":{"id":260214011,"uuid":"124947812","full_name":"EngineerMichael/-Vehicle-Management-App-Android-Studios-","owner":"EngineerMichael","description":"Android Application(Pending Revision)","archived":false,"fork":false,"pushed_at":"2024-12-23T03:27:36.000Z","size":139,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-11-13T07:21:54.589Z","etag":null,"topics":["android-app","kotlin","vehicle-tracking","xml"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EngineerMichael.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-12T20:31:50.000Z","updated_at":"2024-12-23T03:27:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"1b81cc07-5ddb-4f2f-9381-eb2a0de7589a","html_url":"https://github.com/EngineerMichael/-Vehicle-Management-App-Android-Studios-","commit_stats":null,"previous_names":["engineermichael/-vehicle-management-app-android-studios-"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/EngineerMichael/-Vehicle-Management-App-Android-Studios-","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineerMichael%2F-Vehicle-Management-App-Android-Studios-","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineerMichael%2F-Vehicle-Management-App-Android-Studios-/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineerMichael%2F-Vehicle-Management-App-Android-Studios-/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineerMichael%2F-Vehicle-Management-App-Android-Studios-/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EngineerMichael","download_url":"https://codeload.github.com/EngineerMichael/-Vehicle-Management-App-Android-Studios-/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineerMichael%2F-Vehicle-Management-App-Android-Studios-/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33205467,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T09:27:30.708Z","status":"online","status_checked_at":"2026-05-19T02:00:06.763Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android-app","kotlin","vehicle-tracking","xml"],"created_at":"2025-01-03T13:52:18.512Z","updated_at":"2026-05-19T07:04:11.185Z","avatar_url":"https://github.com/EngineerMichael.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# -Vehicle-Management-App-Android-Studios-\nAndroid Application\n\nCreating a basic Vehicle Management app using Kotlin for Android involves several components like user interface, database management, and handling user inputs. Below is a simple guide and code structure to help you build a basic vehicle management app.\n\n\n//1. Project Setup\t\n•\tCreate a new project: Open Android Studio and create a new project with an “Empty Activity” template.\t\n•\tSelect Kotlin as the programming language.\n\n\n//2. Add Dependencies\nEnsure that you have the necessary dependencies for RecyclerView and Room (SQLite database) in your build.gradle file.\ndependencies {    \n    implementation \"androidx.recyclerview:recyclerview:1.2.1\"    \n    implementation \"androidx.room:room-runtime:2.5.0\"    \n    kapt \"androidx.room:room-compiler:2.5.0\"    \n    implementation \"androidx.lifecycle:lifecycle-runtime-ktx:2.6.1\"    \n    implementation \"androidx.room:room-ktx:2.5.0\"}\n\n//3. Define the Data Model\nWe will create a simple data model for the vehicles. This will contain fields like vehicle ID, name, and registration number.\n@Entity(tableName = \"vehicles\")\n\ndata class Vehicle(\n\n    @PrimaryKey(autoGenerate = true) val id: Int = 0,\n\n    @ColumnInfo(name = \"name\") val name: String,\n\n    @ColumnInfo(name = \"registration_number\") val registrationNumber: String\n\n)\n//4. Create the Room Database\nCreate a VehicleDao interface to define the database operations.\n\n\n\n@Dao\n\ninterface VehicleDao {\n\n    @Insert\n\n    suspend fun insert(vehicle: Vehicle)\n\n\n\n    @Delete\n\n    suspend fun delete(vehicle: Vehicle)\n\n\n\n    @Query(\"SELECT * FROM vehicles\")\n\n    fun getAllVehicles(): LiveData\u003cList\u003cVehicle\u003e\u003e\n\n}\n\n\n\nNext, create the database class.\n\n\n\n@Database(entities = [Vehicle::class], version = 1, exportSchema = false)\n\nabstract class VehicleDatabase : RoomDatabase() {\n\n    abstract fun vehicleDao(): VehicleDao\n\n}\n//5. Repository for Data Handling\nWe will create a repository to abstract the data source and provide a clean API for accessing the data.\nclass VehicleRepository(private val vehicleDao: VehicleDao) {\n\n\n\n    val allVehicles: LiveData\u003cList\u003cVehicle\u003e\u003e = vehicleDao.getAllVehicles()\n\n\n\n    suspend fun addVehicle(vehicle: Vehicle) {\n\n        vehicleDao.insert(vehicle)\n\n    }\n\n\n\n    suspend fun removeVehicle(vehicle: Vehicle) {\n\n        vehicleDao.delete(vehicle)\n\n    }\n\n}\n\n\n//6. ViewModel for UI Communication\nNow, create a VehicleViewModel to manage UI-related data in a lifecycle-conscious way.\nclass VehicleViewModel(application: Application) : AndroidViewModel(application) {\n\n\n\n    private val repository: VehicleRepository\n\n    val allVehicles: LiveData\u003cList\u003cVehicle\u003e\u003e\n\n\n\n    init {\n\n        val vehicleDao = VehicleDatabase.getDatabase(application).vehicleDao()\n\n        repository = VehicleRepository(vehicleDao)\n\n        allVehicles = repository.allVehicles\n\n    }\n\n\n\n    fun addVehicle(vehicle: Vehicle) {\n\n        viewModelScope.launch(Dispatchers.IO) {\n\n            repository.addVehicle(vehicle)\n\n        }\n\n    }\n\n\n\n    fun removeVehicle(vehicle: Vehicle) {\n\n        viewModelScope.launch(Dispatchers.IO) {\n\n            repository.removeVehicle(vehicle)\n\n        }\n\n    }\n\n}\n\n\n//7. Create the User Interface\nNow, define a simple interface to interact with the user. We’ll create a simple list of vehicles and a button to add vehicles.\nactivity_main.xml (for displaying vehicles and adding a new one):\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\u003candroidx.constraintlayout.widget.ConstraintLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n\n    xmlns:tools=\"http://schemas.android.com/tools\"\n\n    android:layout_width=\"match_parent\"\n\n    android:layout_height=\"match_parent\"\n\n    tools:context=\".MainActivity\"\u003e\n\n\u003candroidx.recyclerview.widget.RecyclerView        \nandroid:id=\"@+id/vehicleRecyclerView\"        \nandroid:layout_width=\"0dp\"        \nandroid:layout_height=\"0dp\"        \napp:layout_constraintBottom_toBottomOf=\"parent\"        \napp:layout_constraintEnd_toEndOf=\"parent\"        \napp:layout_constraintStart_toStartOf=\"parent\"        \napp:layout_constraintTop_toTopOf=\"parent\"/\u003e\n\u003cButton\n\n        android:id=\"@+id/addButton\"\n\n        android:layout_width=\"wrap_content\"\n\n        android:layout_height=\"wrap_content\"\n\n        android:text=\"Add Vehicle\"\n\n        app:layout_constraintBottom_toBottomOf=\"parent\"\n\n        app:layout_constraintEnd_toEndOf=\"parent\"\n\n        app:layout_constraintStart_toStartOf=\"parent\"\n\n        app:layout_constraintTop_toTopOf=\"parent\"/\u003e\n\n\u003c/androidx.constraintlayout.widget.ConstraintLayout\u003e\nvehicle_item.xml (for each vehicle entry in the RecyclerView):\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\u003candroidx.cardview.widget.CardView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n\n    android:layout_height=\"wrap_content\"\n\n    android:layout_margin=\"8dp\"\u003e\n\n    \u003cLinearLayout\n\n        android:orientation=\"vertical\"\n\n        android:padding=\"16dp\"\n\n        android:layout_width=\"match_parent\"\n\n        android:layout_height=\"wrap_content\"\u003e\n\n        \u003cTextView\n\n            android:id=\"@+id/vehicleName\"\n\n            android:layout_width=\"match_parent\"\n\n            android:layout_height=\"wrap_content\"\n\n            android:textSize=\"18sp\"\n\n            android:text=\"Vehicle Name\"/\u003e\n\n             \u003cTextView\n\n            android:id=\"@+id/registrationNumber\"\n\n            android:layout_width=\"match_parent\"\n\n            android:layout_height=\"wrap_content\"\n\n            android:text=\"Registration Number\"/\u003e\n\n            \u003c/LinearLayout\u003e\u003c/androidx.cardview.widget.CardView\u003e\n\n\n\n//8. RecyclerView Adapter\nNow, create a RecyclerView adapter to bind data to the list of vehicles.\nclass VehicleAdapter(private val vehicleList: List\u003cVehicle\u003e) : RecyclerView.Adapter\u003cVehicleAdapter.VehicleViewHolder\u003e() {\n\n\n\n    class VehicleViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {\n\n        val vehicleName: TextView = itemView.findViewById(R.id.vehicleName)\n\n        val registrationNumber: TextView = itemView.findViewById(R.id.registrationNumber)\n\n    }\n\n\n\n    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VehicleViewHolder {\n\n        val view = LayoutInflater.from(parent.context).inflate(R.layout.vehicle_item, parent, false)\n\n        return VehicleViewHolder(view)\n\n    }\n\n\n\n    override fun onBindViewHolder(holder: VehicleViewHolder, position: Int) {\n\n        val vehicle = vehicleList[position]\n\n        holder.vehicleName.text = vehicle.name\n\n        holder.registrationNumber.text = vehicle.registrationNumber\n\n    }\n\n\n\n    override fun getItemCount(): Int = vehicleList.size\n\n}\n\n\n//9. MainActivity\nFinally, connect everything in the MainActivity.\nclass MainActivity : AppCompatActivity() {\n\n\n\n    private lateinit var vehicleViewModel: VehicleViewModel\n\n    private lateinit var vehicleAdapter: VehicleAdapter\n\n\n\n    override fun onCreate(savedInstanceState: Bundle?) {\n\n        super.onCreate(savedInstanceState)\n\n        setContentView(R.layout.activity_main)\n\n\n\n        // Set up RecyclerView\n\n        val recyclerView: RecyclerView = findViewById(R.id.vehicleRecyclerView)\n\n        recyclerView.layoutManager = LinearLayoutManager(this)\n\n\n\n        vehicleViewModel = ViewModelProvider(this).get(VehicleViewModel::class.java)\n\n\n\n        vehicleViewModel.allVehicles.observe(this, Observer { vehicles -\u003e\n\n            vehicleAdapter = VehicleAdapter(vehicles)\n\n            recyclerView.adapter = vehicleAdapter\n\n        })\n\n\n\n        val addButton: Button = findViewById(R.id.addButton)\n\n        addButton.setOnClickListener {\n\n            // Example: Adding a new vehicle\n\n            val newVehicle = Vehicle(name = \"Car\", registrationNumber = \"XYZ123\")\n\n            vehicleViewModel.addVehicle(newVehicle)\n\n        }\n\n    }\n\n}\n\n\n//10. Room Database Initialization\nEnsure that you initialize the Room database properly when accessing it.\nobject VehicleDatabase {\n\n    @Volatile\n\n    private var INSTANCE: VehicleDatabase? = null\n\n\n\n    fun getDatabase(context: Context): VehicleDatabase {\n\n        return INSTANCE ?: synchronized(this) {\n\n            val instance = Room.databaseBuilder(\n\n                context.applicationContext,\n\n                VehicleDatabase::class.java,\n\n                \"vehicle_database\"\n\n            ).build()\n\n            INSTANCE = instance\n\n            instance\n\n        }\n\n    }\n\n}\n\nGNU General Public License v3.0 \n\n\n//11. Running the App\t•\tRunning the app will display a list of vehicles. You can add vehicles by clicking the “Add Vehicle” button.\t•\tYou can modify the addVehicle function to accept inputs (like name, registration number) from a form or another interface.\nThis is a simple foundation for a vehicle management app. You can extend it with additional features like vehicle detail views, update functionality, or filtering based on various criteria.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fengineermichael%2F-vehicle-management-app-android-studios-","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fengineermichael%2F-vehicle-management-app-android-studios-","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fengineermichael%2F-vehicle-management-app-android-studios-/lists"}