Questions tagged as 'java'

2
answers

call a method in an Android activity

public void onDateSet(DatePicker view, int year, int month,int day){ String date = day+"/"+(month+1)+"/"+year; Activity1 act1 = new Activity1(); act1.MostrarDatos(date); } As you can see I want to run a method of the first activi...
asked by 21.12.2016 / 00:37
2
answers

Recursive to iterative with bottom-up

This is my code of a recursive function written in an non-final form, I would like to pass it to iterative with a while, but I really can not do it, advice to do it with bottom-up? The abc method is a square root (x), and the number of iterati...
asked by 25.10.2016 / 18:40
4
answers

when wanting to create a receipt object "non-static variable this can not be referenced from a static context"

I have a program that should simulate a card game. The Deck class is responsible for creating the deck and shuffling it (Naipe object). When trying to create the object (only one will be created) I get the error of the title. This is my main...
asked by 22.03.2018 / 22:27
3
answers

How can I execute a method for about 10 minutes on Android and after that time stop running?

How could I do that, for example, a method or condition runs a few minutes and then stops working when the time limit expires.     
asked by 08.07.2016 / 01:24
3
answers

Problem with eclipse - Debian

happens that I use I am recently testing java, and I installed eclipse on my computer, it is not high performance, I decided to install the plugin to program android apps with eclipse and after finishing the installation of the jdk, when trying...
asked by 22.08.2016 / 05:25
3
answers

What happens when I open a FileReader / FileWriter?

I have a question which basically deals with the classes FileWriter and FileReader . When I installed these classes, I understood that a connection is opened between the chosen file and the java program, now, why do I have to close...
asked by 21.02.2016 / 03:46
1
answer

My question is related to regular expressions in Java [closed]

my problem comes with the following code: private void _loadInfo(String sFile){ InfoCategory categoria = null; String linea; String regex = "^\[\d{3}(-\d{4}){1,2}\]$"; // [XXX-XXXX] o [XXX-XXXX-XXXX] String codCategoria = nul...
asked by 10.02.2018 / 13:16
3
answers

How to enter data in the same line

How can I enter data on the same line? public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Introduce la hora"); int hora = sc.nextInt(); System.out.print(":"); int minutos = s...
asked by 20.09.2018 / 13:41
2
answers

Program divisor of a number in java

I'm trying to do a class exercise, I'm a rookie in java and this is my second task. The statement is this: Make a Java program that asks the user for a whole number. After processing it, the program informs if the number is divisible by 2...
asked by 17.10.2018 / 11:07
2
answers

Activity is not displayed

Good morning, I am learning to program in java with the Android Studio tool ... I am trying to call another activity through a button but in the emulator, when I press the button, the application closes and the IDE gives me this error FATAL EX...
asked by 11.09.2017 / 01:42