Questions tagged as 'java'

2
answers

Format Timestamp for string without milliseconds?

I have the following variable public Timestamp CreatedAt; It is set to textview this way: hora.setText(String.valueOf(notificacao.CreatedAt)); The output is:    2017-06-29 12: 31: 21,759 I would like it to be:    6/2...
asked by 29.06.2017 / 20:31
1
answer

Recovering information passed in a Bundle

I have a Fragment that calls another fragment passing login information to the other. I do this with the following code through the Bundle. Here is the code: ImageView editarBt = (ImageView) view.findViewById(R.id.editar); editarBt...
asked by 26.06.2017 / 17:44
1
answer

Problem in calculator in android studio

I'm a beginner and I'm developing a simple calculator in android studio, but it only shows the result of two values, eg 1 + 1 = 2. I would like to do several operations at the same time, eg 1 + 2 * 3/4. Follow the code import android.support.v...
asked by 04.04.2017 / 20:21
1
answer

"What eh" / "how to solve" a "null object reference" error? What appears on the console?

When I try to use the code below (which alias I got with the help of OS friends) I get an error on the line:
asked by 31.01.2017 / 00:50
1
answer

Doubt with parameter in Java 8 to generate random numbers using Collectors.toList () [closed]

I have this method to generate random numbers in ArrayList ; public static List<Integer> gerarAleatorio() { List<Integer> aleatorios = new ArrayList<>(); while(aleatorios.size() < 6) {...
asked by 22.12.2016 / 19:37
1
answer

Ignore parameter if null

I have the following method that searches the database: public Collection<Habilidade> pesquisar(HabilidadeForm form) throws Exception { String query = "select u from Habilidade u where u.nome like ?1 and u.geracao = ?2";...
asked by 05.01.2017 / 23:38
1
answer

Application works in eclipse and stops working after generating the executable JAR

I'm working on two applications here in the company that are giving me a certain headache for a reason that the solution should be simple plus I can not find the error, the two applications normally work within eclipse, more when I generate the...
asked by 05.01.2017 / 12:21
1
answer

How to concatenate strings of a 3-in-3 vector in Java?

I need to concatenate the elements of a 3-by-3 vector. Here's the sample I need: package ex; public class prog { public static void main(String[] args) { // TODO Auto-generated method stub String[] vetor = {"aaa", "aa...
asked by 21.12.2016 / 03:05
1
answer

List within the Spinner Layout

Hello, I would like to know if you have how to put the list that is inside Spinner directly in the layout. I usually do this: horario = new ArrayList<>(); horario.add(""); horario.add("Aberto Hoje"); horario.add("Não impo...
asked by 06.12.2016 / 03:36
1
answer

Send address to search google maps

Hello, I ask for help on the following: I have a TextView with an address, I would like it when I clicked to make an Intent by sending this address to search the user's Google Maps app itself. I know I can use the Google Maps API, but I'd lik...
asked by 04.12.2016 / 14:44