Questions tagged as 'java'

1
answer

Android - Run function with seconds of delay

My question is: how do I make one function run after another? MainActivity.class public void onClick(View p1){ //quero que essa função seja executada primeiro Toast.makeText(getApplicationContext(), "Toast 1", Toast.LENGTH_SHORT)....
asked by 28.05.2018 / 13:46
1
answer

How to retrieve an object from a HashSet

I store my votes within a HashSet , however I'd like to do a vote count on a Class Result. How do I retrieve these votes and group by quantity? import java.util.Collection; import java.util.HashSet; public class Votacao { private...
asked by 26.05.2018 / 17:37
4
answers

Add 0 to the left in an ArrayList Integer

Hello, this code returns 6 values between 1 and 60 without repeating and in order. But for numbers smaller than 10 I'd like to add 0 before type: 01.02 ... 10. I tried to use String.format () but it gives error when compiling. Thank you. pr...
asked by 18.10.2018 / 20:36
1
answer

Problems with if not managedbean

I have a login form with the registration and password fields. I'm trying to validate this login where only the registration "92018" can log in the system, but when the logar method is called, it does not pass through if, even if I typed the cor...
asked by 13.10.2018 / 04:08
1
answer

List getResults returns list with elements equal

Hello. I have the following table in mysql: create table resultado( data varchar(10), premio varchar(3), loteria varchar(5), milhar varchar(10), primary key(data, premio, loteria) ); The class representing this table in Java: public cl...
asked by 22.10.2018 / 04:28
1
answer

How to use the Strings file inside the code

Example strings.xml <string name="beer">Beer</string> Example strings (en-us) <string name="beer">Cerveja</string> In the code I wanted to reference this: @Override public void onClick(Vie...
asked by 05.05.2018 / 19:48
1
answer

Data Structure, Circular Row. Doubts about the Debug and Queuing methods

I can not understand the two else blocks in methods Desenfileirar and Enfileirar . More specifically the lines: this.tras = (++this.tras % this.info.length); this.frente = (++this.frente % this.info.length); Why use the...
asked by 16.05.2018 / 20:49
1
answer

Error using AsyncTask more than once

I'm developing an application for android that connects to a webservice, to do the connection part I used an AsyncTask to avoid crashes, but when I run the application I can register the user only once, after that I try to register again it retu...
asked by 26.04.2018 / 03:40
1
answer

Get name resolution time on HTTP request

Live, Is it possible to get the name resolution time separate from the access time? The code I have is: HttpURLConnection connection; try { URL endereco = new URL(url); connection = (HttpURLConnection) endereco.openConnection();...
asked by 06.04.2018 / 16:43
1
answer

Test APK Dependency Conflicts

In an old application that I was updating the dependency version of the gradle, on execution I received the following message regarding a conflict between the dependency version com.google.code.findbugs:jsr305 for app and for test:   ...
asked by 04.04.2018 / 20:51