
Network connections (like connection to database) must be done in an AsyncTask using doInBackground(). In this step, we’ll add an empty activity to our app. Name your application as MyFirstProject and then click next. On the screen above, click on Start a new Android Studio Project.

This will result in an error because you need to enter the database name without a slash at the and, like: conn = DriverManager.getConnection("jdbc:postgresql://:5432/databaseName", "username", "password") How to Create an Android App using Android Studio Create the Android App in Studio. conn = DriverManager.getConnection("jdbc:postgresql://localhost:5432/","root","root").I copied your example and worked with it because I also need to get postgres running on android. Okay, this may be obsolete but still helpful for users (it was helpful for me) Sql = "SELECT first, last FROM Employees"

("Connecting to database.") Ĭonn = DriverManager.getConnection("jdbc:postgresql://localhost:5432/","root","root") Static final String DB_URL = "jdbc:postgresql://localhost:5432/user1" Is this correct? Or should I write it else where? static final String JDBC_DRIVER = "" I wrote this code in my MainActitvity.java. How to connect Android Studio with postgressql? Step by step! I though have been through tutorial but still didn't get any solution.

I'm new to android and not much aware about it.
