Questions tagged as 'java'

2
answers

How do I persist the String of an Enumerator in the Database?

I have the following Enumerator: public enum ETipoCasa{ Propria, Alugada, Financiada, Cedida; } And I'm trying to persist in the bank the String of this enumerator as the example: Casa casa = new Casa(); casa.setTipo...
asked by 02.07.2015 / 17:23
1
answer

How to know if two periods intersect?

Let's say I have 2 objects that have the following property: Objeto 1: Date dataAtivacao; Date dataDesativacao; Objeto 2: Date dataAtivacao; Date dataDesativacao; How do you know if these dates "cross". For example: EXEMPLO 1, ENTRADA:...
asked by 30.06.2015 / 05:07
2
answers

Separating a String, how do I?

I have one: String url = intent://instagram.com/_u/fabiohcnobre/#Intent;package=com.instagram.android;scheme=https;end How do I separate it so that I get a String link = instagram.com/_u/fabiohcnobre and a String package = com.i...
asked by 29.10.2016 / 22:19
2
answers

ClassCastException error trying to cast between classes

I'm having trouble casting a class in a class, when I use the inherited class method it gives the following error:    "entity.Aula can not be cast to tableview.AulaTV" Here is the exception described above. AulaTV atv = (AulaTV) new Aul...
asked by 26.10.2016 / 13:14
2
answers

Formatting String with DateFormat using a TimeZone is not working

In my web service, there is an endpoint that returns me a timestamp in UTC and I have a method that generates a date formatted from this timestamp: formatDate(1432313391, "UTC"); public String formatDate(long date, String time...
asked by 22.05.2015 / 19:11
2
answers

Java Generics: Unknown wildcards and T

I could verify that in Java we can use both a wildcard ("?") and the "T" (what is this?) to create generic mechanisms (classes, methods, interfaces ...). But it has not been clear to me what are the main differences between these devices and whe...
asked by 12.04.2016 / 20:15
2
answers

JTextField null field validation

On my system, I have a window and a controller, but for some reason, it is never throwing the error, as expected: Method that performs validation: private void validacao(){ if((form.txtNome.getText() != null) && (form.txtEnd.get...
asked by 07.04.2016 / 23:06
1
answer

How to check if there is any null attribute in the object?

I have a Person class and I want to check if there is any null attribute, either because I can not save a person with null attribute. I want to avoid a lot of if . Is there any way to do this? public void salvar(Pessoa p) throws Exception...
asked by 30.03.2016 / 18:07
2
answers

How to use the JSON response?

After a lot of trying I got to this JQUERY AJAX result, but I still can not use the JSON data, it does not work, how should I do it? Help! Thank you The JSON response is at the end jQuery(document).ready(function() { jQuery('#add...
asked by 06.12.2014 / 19:59
2
answers

ListView locking a lot on scroll

My ListView is crashing a lot on the scroll, I already tried to implement the ViewHolder to the Adapter but it did not solve, could you help me? Adapter: public class Adapter extends SimpleAdapter { private Context context; public...
asked by 22.07.2015 / 04:28