Questions tagged as 'java'

1
answer

Create an int variable that recognizes numbers in time format

I have an int variable that is picking up the current android time and comparing with more dua int variables from my database in the parse that contains the opening and closing times of a company in business hours trading works, but when a compa...
asked by 09.09.2017 / 09:17
1
answer

Pass String to array (Xml);

I'm using this code to read a map from an xml file. private void loadMap(String mapa) { File file = new File(getClass().getResource(mapa).getFile()); try { dbBuilder = DocumentBuilderFactory.newInstance().newDocu...
asked by 13.09.2017 / 23:30
1
answer

Retrofit JSON - Error Expected BEGIN_ARRAY but was BEGIN_OBJECT [duplicate]

I've done some Retrofit projects and it always worked but I'm doing one that consumes end-point from api.github.com and is giving an error and I can not find a solution, I've done everything I could, if anyone knows what to do . The error...
asked by 13.09.2017 / 19:59
1
answer

Add SQLITE data in Java

Personal I have a problem that I can not solve in Java. The intention is to make the connection in a SQLite database. But I can not do the insertion. Take a look at the code, please. package conexao; import java.sql.Connection; import...
asked by 28.07.2017 / 21:08
1
answer

How to get communication response using MQTT

I'm developing an application which uses the MQTT communication protocol, where my system sends a command to a certain device, my machine is receiving the command and changing the status. The problem is: how do I get feedback from my device? Bec...
asked by 27.07.2017 / 20:44
2
answers

Duplicate random numbers

I created a class that contains a method that generates a random number from 0 to 61 ... in my Fragment I instantiated within my button event ... My question is, how do I do to put the amount of times it will generate for me. For e...
asked by 28.07.2017 / 15:50
1
answer

Static, private and final variables

I have a question that has been disturbing me for a long time: What is the advantage of creating a static and final variable (both private and public)? If I have a primitive or simple class variable (String for example), they have final...
asked by 22.07.2017 / 14:01
1
answer

NullPointerException / Button findViewById

I have a problem with this code: every time I put it: 'Button botao = (Button) findViewById(R.id.botao_id);' It stops working, it does not run on my phone anymore. And if I take that code (and things related to it, it works again). I asked...
asked by 22.07.2017 / 21:55
1
answer

Comparison of dates is wrong

So I have this code that compares a date with today's date, but sometimes the dates are as follows: D/tag: Sat Jul 22 00:00:00 GMT+01:00 2017 <<-Data indicada D/tag: Sat Jul 22 18:57:17 GMT+01:00 2017 <<-Data de hoje And I...
asked by 22.07.2017 / 20:02
1
answer

incompatible types can not be converted to

I'm starting to study java and after watching the creation of some objects I decided to try to create my own.    Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - incompatible types: deodorant.Desclasse...
asked by 22.07.2017 / 23:45