Most voted "java" questions
Use this tag when the question refers to some resource, information, or problem relating exclusively to the Java programming language. Java is a class-based, statically typed, reflective, and execution environment (JRE) language. Java programs are compiled to bytecode and run on a virtual machine (JVM), allowing a "write Once, run Anywhere" philosophy (WORA).
Learn more…14,468 questions
Sort by count of
-
3
votes1
answer795
viewsError while emulating AVD in android studio
error while trying to emulate a device in android studio He lets create the device, but at the time of emulating this error, I already searched, but not getting anything related.…
-
3
votes1
answer726
viewsReturn values of all months of the year extracting by month
I’m with the following SELECT: SELECT coalesce(sum(vs.total), 0) FROM tabela_exemplo t WHERE extract(year from t.data_entrada) = extract(year from current_date) GROUP BY extract(month from…
-
3
votes1
answer192
viewsHow to use setNextFocusableComponent in a Jtextarea
I used setNextFocusableComponent in a JTextArea, but it doesn’t work because the TAB works as a "space" inside the JTextArea, how to solve this ??
-
3
votes2
answers2696
viewsRegular expression
I have a question how can I make a regular expression to remove phone masks, Cpf, cnpj. I managed to get ("-") out of the zip code String[] cepText = edtCep.getText().toString().split("-"); there in…
-
3
votes1
answer294
viewsGet executed jar name
I would like to get the name of . jar that is running. The . jar will have dynamic names, modified as some hash, and I would like when executed, the same to identify its own file name. The user.dir…
javaasked 7 years, 11 months ago Kelvin Stang Oenning 380 -
3
votes2
answers176
viewsTermination of a Thread
When multiple shots are fired Threads in a specific loop, upon completion of each, the Thread stays open needing a "close" or is automatically finished? for(int i=0;i<=10;i++){ Process ps = new…
-
3
votes1
answer715
viewsHow do I create an event when someone types something in Edittext?
I would like to create an event as the user enters some word in my EditText, but I don’t know how to access it.
-
3
votes1
answer460
viewsSpacing with Gridbaglayout
I’m putting together a layout for testing with Gribbaglayout, but I’m having difficulties with the positioning of the elements. The frame has two panel. I want the items on the left panel (Label 1,…
-
3
votes1
answer1131
viewsHow to implement voice and video calls in my apps
I would like to know how I can implement video and voice calls (similar to Whatsapp) in my Apps written in JAVA for Android. Is there any open source SDK that makes this easy?
-
3
votes2
answers394
viewsSpinner together
I have a Spinner who is responsible for the States of Brazil. And another Spinner responsible for Capitals of Brazil. I need you when you go selected the State another spinner of Cities be unlocked…
-
3
votes1
answer3069
viewsWhat is the advantage of using Bufferedimage for images?
I want to know the difference in using BufferedImage and the method graphics to draw the images to the ImageIcon. Here is an example: @Override public void paint(Graphics g) { g.drawImage(bfImage,…
-
3
votes2
answers547
viewsFormat java.time.Duration for String
The code below is producing the following output: Resultado: PT2H30M I wish it were: Resultado: 2:30 Does anyone know how I can do? import java.time.Duration; import java.time.LocalDateTime; public…
-
3
votes2
answers364
viewsHow to create Checkbox via programming
How to create several Checkbox's via programming?
-
3
votes1
answer116
viewsError "Java" and "C" integration through JNI
Personal I am not managing to consume functions of a lib in "C" using Java with JNI. Follow my artifacts and the error generated. Class CalculadoraJNI: public class CalculadoraJNI { // Declaração do…
-
3
votes0
answers464
viewsPostgresql Nosql and integration between relational and non-relational databases
I have been researching about Postgresql Nosql and found the concept of Key-Value Stores in some publications, also from HSTORE. I also researched the integration between Postgresql and the Spring…
-
3
votes3
answers196
viewsRemove from Integer List
I have a ImageButton the imgB1: When I click on imgB1, add to a list integer, 1. If you click again imagB1, he removes 1 and puts 6. List<Integer> list = new ArrayList<>(); When I click:…
-
3
votes1
answer85
viewsCapture music running in another person’s app
Hello, on Facebook has a button that shows which Spotify song is running. Is there a way to do that in my app? I’ve looked for information but I can not find how to do it on Android. What I want is…
-
3
votes1
answer14854
viewsHow to make POST with parameters in Webservice REST in java?
Hello, I have a problem that I haven’t been able to solve for days. The situation is as follows, until today I only managed to use the GET method of my webservice by passing parameters directly to…
-
3
votes1
answer2358
viewsPlacing event click on the button that is in a Fragment, in an Activity?
I want to put a setOnClickListener on the button that is in a Fragment, through my Activity. Follow the codes: Activity: private Button mButtonCriarConta; // onCreate da Activity...…
-
3
votes1
answer469
viewsAndroid use findViewById from other Activity
I need to assign a value to an element that is in another Activity I’m trying this way: MainActivity activityprincipal = new MainActivity(); WebView view = (WebView)…
-
3
votes2
answers804
viewsHow to use p:messages from Primefaces?
I defined the field nome using p:inputText to receive values, it is a field obligatory. How do I display a message showing that this field is required, using p:messages? I am also using JSF. Follows…
-
3
votes1
answer1289
viewsForeach with Lambda does not work
I have a list of objects I want to go through, but it’s giving error and I’m not understanding why: listaAtendimento.stream().forEach(atendimentoFicha -> {…
-
3
votes1
answer641
viewsTomcat 8, Ajax (jQuery), Jersey, REST API does not work, enable CORS
I have been trying for a while to configure CORS to work with my Tomcat 8. But whenever I have to submit the POST request, I get the error message: "Response to preflight request doesn’t pass access…
-
3
votes1
answer3764
viewsWhat is an Expression Language (EL)?
Widely used in JSF, the famous Expression Languages(EL’s) symbolised by #{}. I don’t know if other languages work the same. What do they mean ?
-
3
votes3
answers1435
viewsHow do I generate a random negative number?
I cannot generate a random number that is negative, for example less than 0
-
3
votes1
answer128
viewsEclipse is corrupting url in automated testing
Good afternoon, you guys! I’m doing an automated test, exporting in java to run in eclipse. The test runs normally in Selenium, but when I play pro eclipse Rs the page url deforms and the test does…
-
3
votes1
answer2296
viewsFormat date on Android and Sqlite
I am having difficulty in making the process of setting the current date of my Sqlite database in the type attribute java.util.Date of my object. The Sqlite date comes in "yyyy-MM-dd" format. I am…
-
3
votes2
answers409
viewsPass-by Object Reference Wrapper to Method
I have been researching about passing by reference in Java and realized that it is not possible to perform this procedure directly. As only object references and array’s can be passed by reference I…
-
3
votes2
answers461
viewsProblem removing element from a chained list
I’m implementing a chained list in Java. However, the removing function is causing me some problems, but specifically the removing part in the middle of the list. My list consists only of a field of…
-
3
votes1
answer100
viewsSpring MVC error in performing Binding of checkboxes on a list of objects
I have the following piece of code in my .jsp, in which the objective is to dynamically list a passenger list per customer. <f:form id="service-item-form" action="${action}"…
-
3
votes1
answer1250
viewsWhat does the "|=" operator mean? (with pipeline and no exclamation)
I was doing some research and came across the operator in sequence |=. Look at: mBuilder.getNotification().flags |= Notification.FLAG_AUTO_CANCEL; There is this operator in JAVA, but I do not know…
-
3
votes2
answers1046
viewsFinding numbers in sequence that multiplied is a result
I helped my cousin solve a math exercise today. The exercise called for two numbers in sequence that when multiplied the result is 16512 (128 * 129). I would like to know a code that would solve…
-
3
votes3
answers1653
viewsArraylist for String with split
I’m trying to break the following ArrayList with a String: ArrayList<Funcionario> funcionarios = new ArrayList(); But when I instate the object, I add the values inside through my method and…
-
3
votes1
answer137
viewsHow to create a new window for each button clicked?
Hello, I’m beginner in programming for android, and I’m making an application (course work IT). The first Activity has 12 buttons with a "table" background, representing the tables of a restaurant.…
-
3
votes1
answer51
viewsSend data to database
I’m studying for a java test on database and I’m very confused, I was making a program based on another, I made a registration screen and it works perfect, the only thing missing is to send and I do…
-
3
votes1
answer760
viewsAccess object array within a switch
Good evening, I’m having trouble accessing and modifying an array of main class objects inside a switch in the view class. The array is declared like this in main: public class Controle { public…
-
3
votes1
answer299
viewsdoubts about Regex using Primefaces
I own a input, where when a name is entered in the field, ex.: João Da Silva, he of the error of Regex. In case this field should allow uppercase and lowercase letters. Now when I put space it does…
-
3
votes1
answer91
viewsHelp with onitemclick listview
I’m trying to get a Toast appears as soon as user chooses an option from Listview, however, when the user chooses the option, it is first loaded to Acticity and then the Toast, and what I really…
-
3
votes1
answer826
viewsVector and Classes, drawing and filling vector in Java
I am doing an exercise that is necessary to create a vector of 10 names, and that has 3 methods. The first method is called register,and has the function to fill the vectors, the second method is…
-
3
votes1
answer252
viewsButton that sends email to contact the developer
How do I create a button that the user click sends an email to another preset email?
-
3
votes1
answer75
viewsObsolete html.fromHtml for Android N+
In Android 7.0 (API level 24) the static method fromHtml() of the public class Html became obsolete I don’t know why, if you know tell me. See an example of how it was used:…
-
3
votes4
answers3199
viewsCheck if String is number, if not, return error to user
I’m making a code in Java using Joptionpane, and in it, I created an Inputdialog that returns the value "1","2" or "3" typed by the user to a String variable called "return". Once this is done, I…
-
3
votes3
answers4536
viewsHow to select a piece of the Java string?
I have the String x = "@646646&". I’d like to take everything in between @ and & and play in another String. Regardless of what is between these characters being number or not. How do I do?…
-
3
votes1
answer69
viewsRequestcontext as null
I’m trying to update a component on the screen by RequestContext of primefaces. But there are 2 situations where the first one is I click on a link and the page give your refresh. The second…
-
3
votes1
answer935
viewsJPA/Primefaces - Add/Remove records from a daughter table
I have a problem in a cadastral panel. There is a register of store network in which I am taking care of the implementation. I can normally insert and remove items from the datatable, but this is…
-
3
votes1
answer49
viewsJava - SQL Error Updating All Users
Good morning, I’m having the following problem my updateOur SQL is updating all how I do so that it just updates the User who accessed? public class Acessar { public static Connection con =…
-
3
votes2
answers825
viewsCreate directory and add files to query later on android
I am new in the area of Development. mobile, I am developing a simple app that uses the library Tesseract-OCR in Android Studio and I came across the following situation: I need to store some files…
-
3
votes1
answer3368
viewsImplement Runnable or Thread Extension?
In several Java projects, I’ve seen these two ways to create Threads: With implements Runnable: public class MyRunnable implements Runnable { public void run() { //Código } } //Iniciada com uma…
-
3
votes1
answer2243
viewsFamous error: Conversion error when setting the value XXX to 'null Converter'
Good afternoon. I’m having the famous error "Conversion error when setting the value XXX to 'null Converter'." I’ve seen several topics here and in other forums, Showcase of the first faces and I…
-
3
votes1
answer424
viewsI want to put more than one paragraph in my android xml, do you have how?
I’m trying to do something very simple. I want when the user press the "msg" button to appear a message with at least two short paragraphs just below the button, but I’m finding it difficult to put…