Questions tagged as 'java'

2
answers

how to initialize a string [] with a string-array of Android resources?

That wave friends, I would like to know about the question, what happens is that I have this: String[] data = {"Ejemplo 1", "Ejemplo 2", "Ejemplo 3", "Ejemplo 4"}; and I have this string arrangement in my resources: <string-array name=...
asked by 02.05.2017 / 23:22
2
answers

Paint with random colors

I have the following onDraw : public void onDraw(Canvas canvas) { paint = new Paint(); paint.setColor(Color.RED); canvas.drawRect(rectangulo,paint); } I would like to know how to implement so that it was not just Color....
asked by 05.05.2017 / 10:06
1
answer

What are the ObservableList and where can I use them? [closed]

I start programming in java and I have not been clear about the observable lists, I have seen examples where they relate them to an ArrayList but I do not understand what the end of that relationship is.     
asked by 19.04.2017 / 03:15
1
answer

Synchronize a ViewPager with a BottomNavigationView on Android

I have a ViewPager and a BottomNavigationView that when selecting an element it is located to the corresponding page within the ViewPager , but if I change the page the item BottomNavigationView does not change. The...
asked by 27.04.2017 / 21:54
3
answers

Someone knows why the Java IDE returns an error when I convert from String to GregorianCalendar

BufferedReader br = new BufferedReader (new InputStreamReader (System.in)); String fechaN; System.out.println("Introduce tu fecha de nacimiento en el siguiento formato dd/mm/aaaa"); try{ fechaN = br.readLine();...
asked by 11.04.2017 / 20:10
1
answer

how to tell part of an arraylist's content

What I want is to count the number of workers who have a certain type of char  such as those that are of type 'P' and those that are of type 'R' List<Trabajador> trabajadores = new ArrayList<Trabajador>(); trabajadores.ad...
asked by 22.10.2016 / 03:29
1
answer

Stack of batteries in java

I have several final projects in the subject Data Structure. In all I'm doing well, but in this specific, for more than I try, I can not find the solution. The problem proposes the following:    Stack of pilitas: The elements of ED PILITA...
asked by 26.10.2016 / 03:33
2
answers

How can I iterate a JSONArray of objects with a for each in JAVA?

I have the following JSONArray in java and I want to go through it with a foreach , I do not know if it is possible, thanks. [{clave:valor,clave:valor,clave:valor}, {clave:valor,clave:valor,clave:valor}, {clave:valor,clave:valor,clave:...
asked by 30.09.2016 / 21:20
1
answer

Obtain capacity of an ArrayList

In an exercise I am asked to obtain the size and capacity of a previously filled Vector and ArrayList. In the case of the vector there are not many problems to do it, because it has a method. Vector<Object> planetas = new Vector<&g...
asked by 15.09.2016 / 10:16
1
answer

Problem with updating method in Database

I have this method save in a class that controls frame events: if(e.getSource()== estMostrar.getBtnModificar()){ String nombre= estMostrar.getTxtNombre().getText(); String materia= estMostrar.getTxtMatricula().getText();...
asked by 09.09.2016 / 03:16