Questions tagged as 'java'

2
answers

JdbcTemplate - How to commit and rollback?

I'm working with a Desktop application and I use spring to hold my inserts in the database. The object I'm using is the JdbcTemplate, which has the encapsulated datasource inside it. I would like to know how to start new transactions with Jdb...
asked by 28.01.2016 / 20:17
1
answer

Auto zoom

I do not know this function is native to the Google Maps API but I can not start the zoom map in my location, follow my code. public class MainActivity extends FragmentActivity { GoogleMap mGoogleMap; @Override protected void onC...
asked by 21.11.2015 / 20:46
1
answer

how do I format the value of a double variable in android?

I am making a small application that aims to calculate the IMC of a person, but I am not able to format the output value to only two decimal places always something like: 22.222222 or 31.23232322 etc ... I have tried to use the "% .2f", but Text...
asked by 02.12.2015 / 21:23
1
answer

Java - How to validate user group in SQL and Save result?

Good morning, I have the following code in Java Desktop. I wanted to know how I can capture that user's group and save it to a variable. Since when it returns the value and stores in the variable "rs" does not contain information understood f...
asked by 30.11.2015 / 16:22
1
answer

Login method always returns false [duplicate]

I've created a method that returns a boolean value for access in a program I'm doing. If the user is able to login, then returns true , otherwise, returns false . But it is always returning false , regardless if the login and...
asked by 03.12.2015 / 00:52
1
answer

Discover the size of a directory

I would like to know if it would be possible to find the size of a directory in JAVA . I have a cache folder on my system and I would like to make a function whenever this folder exceeds a predefined size I could do a cleanup on it, however...
asked by 08.12.2015 / 02:11
2
answers

I'm having a nullpointer error and I do not know how to fix

The code I'm using is this: public ForumGroups getMainGroup() { if (Constants.SQL_ENABLED) { int lowest = -1; ForumGroups g = null; for (ForumGroup group : forumGroups) { if (group.ge...
asked by 27.08.2015 / 16:08
1
answer

Problems with database connection

I'm developing a test program for integration with webservice . webservice itself was developed in Eclipse . It is a simple user registration and login service. When I run the program on Android and try to register a new user, it appears tha...
asked by 01.10.2016 / 03:12
1
answer

p: selectOneMenu not listed

I am in the fight trying to populate a selectOneMenu with data of a Enum , but when I gave up and put the static data with f:selectItem I realized that even then the field is empty. Even with the value filled with #{clie...
asked by 21.09.2015 / 18:56
1
answer

Calculating a value a raised to an exponent b

I must create an algorithm that calculates a value a high to an exponent b. It is an exercise that can not use Math.pow. I made the algorithm and when I put negative exponent the result buga. public static void main(String[] args) {...
asked by 16.09.2015 / 07:31