Questions tagged as 'java'

1
answer

Convert an integer into a float with decimal places

How can I do to transform a number: 5 In: 0.0005 10 in: 0.0010 I'm trying this way: int numero = 5; float numero2 = Math.abs(numero / 10000); But it is returning me like this: 0,0     
asked by 21.12.2017 / 18:17
1
answer

How to get the Android version number?

I would like to know how to get the version number of Android in which my application that uses WebView is running, to put in the UserAgent, as in the code below: mWebView.getSettings().setUserAgentString("Mozilla/5.0 (Linux; App Mobile Andro...
asked by 07.11.2016 / 05:35
1
answer

How to use the same onClickListener in more than one View?

I would like to know the following, I have: ImageButton btneditarusuario; and a TextView editarusuario; , clicking on either one starts startActivity . How to group ImageButton with TextView so you do not have...
asked by 06.11.2016 / 17:13
2
answers

Help in printing code of repeated characters

I want to print only the characters that are repeated in the string and the number of reps. If it only appears once, I do not want to print it. I need help with the boolean expression. How do I check if the character is repeated? and has...
asked by 03.12.2017 / 06:25
1
answer

Access WebService localhost - Android Studio

I have a webservice that was made in ASP.NET in VisualStudio 2013, I'm running it locally (localhost), and I'm not able to access it in the Android Studio Android emulator, nor on my physical device (USB debugging) . I tried to use IP 10.0.2....
asked by 30.11.2017 / 14:03
1
answer

Make the text and the image specify when you click on the button?

I want to do a project where clicking the button will appear a text and when the text appears I want an image to appear together. ex: random text chosen "the dog is silly" appears the photo of the dog. follow my current code public class Ma...
asked by 07.11.2017 / 15:31
1
answer

How to force threads to perform certain functions?

10 threads are agreed upon when the Client connects to the server, when the Client asks for a word, the server wakes up these threads and they will go through a list of tasks. What I wanted to happen: whenever a thread scans () that word, rem...
asked by 07.12.2017 / 02:24
1
answer

Mockito - Function that receives jsonObject return false

public class ParseProcessoTest { private final String PATTERN_DATA_HORA = "yyyy-MM-dd HH:mm:ss"; JSONObject jsonObject = new JSONObject("json qualquer"); JSONObject jsonMov = new JSONObject("json qualquer 2"); ParseProcesso parseP...
asked by 23.10.2017 / 15:54
1
answer

Overwriting methods of an interface

I'm having a question about overwriting methods of an interface. Can I override a method in a child class that inherits from the parent class the implementation of an interface and in that method use receive parameters? Interface: public in...
asked by 24.10.2017 / 00:57
1
answer

Error in eclipse

I installed and configured java jdk 9.0.1 and also eclipse as java ide in eclipse when I create the project gives me error And as soon as I start typing "System.out.println" this error window appears How can I resolve this? Thanks  ...
asked by 24.10.2017 / 14:56