0

I have an android app that connects to the MySQL through jdbc,I use connection string where I want to append the IP to it by detecting innetwork.

String url = "jdbc:mysql://"+host+":"+  port + "/" + dbname;

where port and dbname are hardcoded,where IP is retrieved by a method and stored in host variable.

I can able to print the connection string through Toast.maketext() and it displayes perfectly,but while connecting to db it shows a nullpointer exception.

Sukan
  • 346
  • 1
  • 3
  • 19

0 Answers0