Posts

Showing posts with the label Android

Android & Spring Boot: File Upload, List, Download, and Delete

Image
Below is a basic example of how to create an Android application that interacts with a Spring Boot backend for file upload, listing, download, and deletion functionalities. Spring Boot Backend Setup Spring Boot Application Add dependencies to pom.xml : <dependencies> <dependency> <groupId> org.springframework.boot </groupId> <artifactId> spring-boot-starter-web </artifactId> </dependency> </dependencies> Controller for File Operations import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind. annotation .*; import org.springframework.web.multipart.MultipartFile; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.stream.Collectors; @RestController @RequestMapping( "/files" ) ...

Building an Android App with Spring Boot for CRUD Operations

Image
Here’s an end-to-end guide to building a complete CRUD application using Android as the front end and Spring Boot as the backend. We’ll cover the following steps: Backend with Spring Boot Setting up the Spring Boot project Creating the REST API Implementing CRUD operations Testing the backend Frontend with Android Setting up the Android project Connecting to the Spring Boot API Performing CRUD operations Displaying data in RecyclerView Testing and Deployment Step 1: Backend with Spring Boot 1.1 Setting up Spring Boot Project Use Spring Initializr to generate a new project with the following dependencies: Spring Web Spring Data JPA H2 Database (or MySQL for production) Lombok (optional, for reducing boilerplate code) Configure the application.properties file: spring .datasource .url =jdbc: h2 :mem:testdb spring .datasource .driver-class-name =org .h2 .Driver spring .jpa .database-platform =org .hibernate .dialect .H2Dialect spring .h2 .console .enabled =true 1.2 Creating the REST...

React Native DatePicker for Mobile Application - Example

Image
In this section, we will learn how to use DatePicker with  React native application.   User Interface: Implementation:   You must set up your local development environment. Follow the below link to set up your local environment. React Native - Environment Setup - Create a new project After executing the commands mentioned in this link, a folder with a specified name will generate with the following contents. Add react-native-datepicker-dialogue and moment library inside your project  npm i react-native-datepicker-dialog --save npm install --save moment react-moment  Next, we are going to edit the App.js file and write the below code.   App.js: import React, { Component } from 'react' ; import { AppRegistry, StyleSheet, Text, View, TouchableOpacity } from 'react-native' ; import { DatePickerDialog } from 'react-native-datepicker-dialog' import moment from 'moment' ; export default class App extends Component { ...