Questions tagged as 'java'

2
answers

Error "is not an enclosing class"

I'm doing a Handler exercise just to test how it works, but I'm trying some problem I can not figure out. This is my main class code: public class MainActivity extends Activity { protected static final int MENSAGEM_TESTE = 1; private Handl...
asked by 01.12.2016 / 14:19
2
answers

Toast is not displayed [duplicate]

I have a problem, Toast does not appear when I make a request in to my web service, the whole method stays inside my thread, I made a test putting a message out of the thread it appears, but well where I need it, it does not display with the m...
asked by 08.12.2016 / 18:29
1
answer

Click JPanel does not work

I'm creating an interface for a system and would like it when the user clicked on a JPanel , open another window. The program is compiled normally, but by the time I click on JPanel , it does not open the desired window and exception...
asked by 12.12.2016 / 01:41
2
answers

How to Order List (Hibernate)

How can I sort a List with java and Hibernate? I have an abstract class with this method public List<T> listarContas(String where) { String consulta = "FROM " + entityClass.getSimpleName()+ " where "+ where; Query query = getE...
asked by 02.05.2017 / 16:28
1
answer

Character array does not write correctly

I'm doing a program to encrypt according to the Cipher of Caesar in Java. I came across the following problem in the code: package projects; import java.util.Scanner; public class Projects { public static void main(String[] args) {...
asked by 18.04.2017 / 16:21
1
answer

What is the difference between JAVA WEB and NetBeans JAVA EE?

What is the difference between the JAVA WEB project type and NetBeans JAVA EE?     
asked by 19.04.2017 / 04:07
1
answer

Working with high-quality images in sqlite3

In my application I make the selection of an image of the gallery, then I save it in the bank, but if the image has a high quality the app does not save, besides saving it stops working, has some way of save that image in the bank even if it is...
asked by 19.10.2016 / 20:22
1
answer

Why is it infinite loop in println?

   Build a program that is capable of averaging all   whole or actual arguments received from the keyboard and print them.       Invalid arguments should be disregarded (Print a message   for each invalid value.), without triggering exceptions...
asked by 17.09.2016 / 01:37
2
answers

Put a name depending on the number of the array

Let's say I have 4 variables: - Porto = 1 - Benfica = 2 - Sporting = 3 - Braga = 4 I have this code that makes me a shuffle of numbers in an array called "arr". Integer[] arr = {1,2,3,4}; Collections.shuffle(Arrays.asList...
asked by 16.03.2018 / 18:49
2
answers

Run Service with a BroadcastReceiver

I need to execute a Service through a BroadcastReceiver , but the error occurs: android.os.NetworkOnMainThreadException . To "deviate" from the error, I'm using the code below, but I want to do it the right way. StrictMod...
asked by 11.03.2018 / 00:09