Questions tagged as 'java'

3
answers

Complement to 1 and complement to 2

Why in this code: int a = 2, b = 0, c = 0; c = -a; // resultado c = -2 c = ~b; // resultado c = -1 Why in the first case c=-2 and in the second c=-1 ?     
asked by 15.07.2016 / 12:11
4
answers

Work with dp on Android

My question I think should be simple to answer, but I really do not know the answer so it goes there: I am trying to subtract the original height of a layout 50 dps . Right now I do it in the following way: v.getLayoutParams()....
asked by 20.01.2017 / 21:57
7
answers

Differences between x ++ and ++ x

In the code I see many times x++ in loops, but sometimes I find ++x . Is there any difference between these two expressions?     
asked by 03.12.2015 / 18:04
2
answers

How to generate a dynamic menu with NavigationView that contains a notification counter?

I am developing an Android application that contains a menu that is generated dynamically, so the menu is generated by programming: private void cargarAvisosMenu() { // Menu final Menu menu = this.mNavigationView.getMenu(); // C...
asked by 10.12.2015 / 10:25
6
answers

What is the difference between static and final?

I searched the Internet but it was not clear to me what these reserved words mean and what features they have in a class: static final
asked by 16.02.2017 / 22:17
3
answers

notification push android do something when it arrives push closed app

I have in my app configured push notifications with firebase, all right here, I receive notifications with the app turned on and off, when it is open and something arrives I ask for the body to do certain actions for example to open another acti...
asked by 30.03.2018 / 19:41
5
answers

It is good practice to use 'return' functions or 'void' methods

Question taken to answer a comment , so that it can be better understood, and because I think it can be an interesting and useful question for other users who may wonder the same thing. Regarding the returns I know that being void function...
asked by 13.05.2017 / 22:47
5
answers

Is it possible to read a character by keyboard in Java?

I would need to know how to read a character by keyboard in Java . I know you can read a number, or a phrase, but this time I would like you to read just one character, and that the system displays a message, immediately after pressing that...
asked by 27.11.2016 / 23:07
2
answers

Search data in an ArrayList of objects

I am creating an application where each user has their respective profile. These profiles are stored in a ArrayList . I have problems when creating a method to find registered or present users in ArrayList and I have to do it with 2...
asked by 10.05.2016 / 16:00
2
answers

How to delete a character written by console in Java?

Is there a way to delete a character written by console with System.out or System.err ? For example, if I have a process that loads for a while, simulate an animation with the 3 ellipsis ... . Something similar to this...
asked by 15.12.2015 / 17:33