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
-
1
votes1
answer171
viewsError while creating android studio Fragment
I’m doing an android course that has navigation in bars and for this is used Ragments, I did the video way however tabs appear but the content of Ragments no, in the console I have this error:…
-
1
votes1
answer499
viewsError saving JPEG image in database as string (Base64)
I’m developing an app that has a form where the user can attach a photo to the form. However I am having difficulty implementing this. In my APK I already capture the image, convert to base 64 and…
-
1
votes1
answer100
views -
1
votes1
answer1542
viewsjava.lang.Securityexception: Permission Denial: Tarting Intent
I’m developing an Android phone call app. Give me the following exception: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.CALL dat=tel:xxxxxxxxx…
-
1
votes1
answer212
viewsJava @Path and @Produces error
Error in the use of @Path in Java. package resource; import java.util.ArrayList; import java.util.List; import java.nio.file.Path; import java.nio.file.Paths; import domain.Album; import…
-
1
votes1
answer107
viewsSimulate Database Update with Select
How I could make a select in the table below (Mysql) to solve the method (Java)? re data is_folga 10 01/01/2017 0 10 02/01/2017 0 10 03/01/2017 0 10 04/01/2017 0 10 05/01/2017 1 10 06/01/2017 1 10…
-
1
votes1
answer51
viewsError creating Poup menu in cardview
I’m creating an application that I use cardview in my list. And I’m having difficulty adding the menu in cardview, as image below: My class of cardview: class CustomAdapter extends BaseAdapter{…
-
1
votes1
answer587
viewsMock non-static method of a class containing a call from another static method
Hello, The title got a little fuzzy, but come on. I have the class below: public class ClasseA { public static final int constA = ClasseB.metodoB(); public int metodoA(){ System.out.println("Passei…
-
1
votes1
answer944
viewsPick up product prices in an array, add them up and present the total sum in a Textview
Hello, guys, so, I’m having a hard time solving a problem here, I’m using a Multiautocompletetextview to pick up products and their prices in the app’s Firebase database, however, I would like to…
-
1
votes0
answers39
viewsExpress Test on Android returns null to mActivityRule.getActivity(). getWindowManager()
I get an error when I try to access the property of Activity mActivityRule.getActivity(). getWindowManager(). getDefaultDisplay(); I tried to change Intentstestrule instead of Activitytestrule and…
-
1
votes0
answers77
viewsAndroid app closes when performing calculation
I’m making an app that has a very specific medical calculator. In AVD, the calculation appears divinely well. On real devices, gives error and the application is closed. Somebody help me out there?…
-
1
votes1
answer280
viewsGrab hidden extension from Uri
I have an app to watch and download videos online, my code detects mimetype by the url to use as the video extension downloaded. But some sites have the hidden extension, such as this url:…
-
1
votes0
answers131
viewsHow to add markers to my map dynamically?
Good guys, I’m developing a mobile application in AS, and I’m using the map to add markers of each location of a new registered form, IE, when performing a registration I send along my latitude and…
-
1
votes1
answer104
viewsI can’t compare with random numbers
my colleagues good night, I made a game of mathematician. random numbers can show it on the interface, but it does not compare the user number with the programmed results I can’t make a comparison.…
javaasked 6 years, 8 months ago Gilliard Pacheco 11 -
1
votes1
answer1401
viewsDelete text in Edittext field
How do I delete a text after sending. enviar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String value = editText.getText().toString(); //push creates a…
-
1
votes1
answer1277
viewsError running Procedure on oracle
I got this trial: CREATE OR REPLACE PROCEDURE buscaturma(cod in INTEGER) AS nomeT varchar2(20); BEGIN dbms_output.put_line('inicio'); IF (cod=0)then dbms_output.put_line('ZERO'); ELSE SELECT…
-
1
votes0
answers574
viewsCharacter string reference not defined
I am developing a Java program in Eclipse, to send Nfse to Camaquã. XML is signed and sent, but returns this error in java: "Exception: Character string reference was not defined as a character…
javaasked 6 years, 8 months ago Mateus Folletto -
1
votes1
answer81
viewsReference main class variable, in a @Override
We can reference a variable of the main class, for example within the method onCreate of the two forms (with or without the this): public class NovoRegistro extends AppCompatActivity { TextView…
-
1
votes1
answer237
viewsWhy inflate a Layout in Fragments instead of setting one already ready? Ex: setContentView(R.layout.activity_example)
I’m learning about Android and would like to better understand how this part of the system works. Instead of inflating a layout, it would not be simpler to do as when creating an Activity, for…
java android android-layout android-fragment android-activityasked 6 years, 8 months ago Nakamoto 1,341 -
1
votes1
answer42
viewsHow to get other values from the selected Spinner item than shown?
Doubt: How do I find the value of the field handle concerning the nome that was selected in the Spinner ? Setting: Table clientes Campos _id, handle, nome The ArrayList of Spinner is established as…
-
1
votes1
answer163
viewsCreate a Spinner from a fixed list with more than 1 field
How do I add the values in this Spinner ? I need to create a Spinner containing 2 "fields" (Cod, option). Default values will be added, but later the codes cannot be changed, so I need the field cod…
-
1
votes1
answer690
views@Autowired does not work with my service
I always run the method that accesses what is in another class with @Autowired it is null, follow the code below: @Component public class TokenAuthenticationService { @Autowired…
-
1
votes1
answer144
viewsFile structure and Deployment of JSF applications with Jboss EAP in Debian 8
I wonder if there is how to configure Jboss EAP to deploy Java applications (JSF, Hibernate, Primefaces, Maven) in the folder /var/www/. The structure of the folder /var/www is the following:…
-
1
votes1
answer1024
viewsChange Icone Javafx
I’m trying to change the icon but I’m not getting it. Code: package olamundojavafx; import com.sun.javafx.scene.SceneHelper; import javafx.application.Application; import javafx.fxml.FXMLLoader;…
-
1
votes1
answer39
viewsGet the content size returned in the request
Hello, I’m using an Interceptor that will intercept before and after the request. The goal of this is to get the size of the content sent and returned, however, I do not know a way to get the…
-
1
votes0
answers246
viewsWebsocket in java and javascript
I have a single server done in JAVA that complete a form of a particular website web. I use the java application as a server to send the information and a extension made for Chrome who acts like…
-
1
votes2
answers89
viewsStandard value in Spinner+ generated from the database
I have a spinner that pulls the bank values, but I would like to leave it with nothing selected or default value: public void spinnerClientes() { ControllerClientes ctClientes = new…
-
1
votes3
answers370
viewsListview with different layouts per line, according to filtered value
I have a unique table in BD, which contains the records with fields like: tipo, data, hora, cliente, historico According to the value of tipo, the field cliente is or is not mandatory, that is to…
-
1
votes1
answer163
viewsApplication delay in switching between screens
When I change the screen, there is always a small delay from one screen to another and it is annoying. You see clearly that one screen closes to open another. you know that java symbol you get when…
-
1
votes1
answer61
viewsCalling more than one callback at the same time
I need a Workerclass that generates sequential numbers to print through a Callback interface these numbers in Mainactivity and a Segundaactivity when opened. My problem is that when Segundaactivity…
-
1
votes0
answers42
views -
1
votes1
answer53
viewsCheck if current time is within the radius set in the database
I wanted to know how to see if the current system time is within a previously defined radius I currently have this code, but it always returns "Closed at the moment" Calendar calendar =…
-
1
votes2
answers1756
viewsUploading files with Java
Good morning! I was trying to upload files, where I have a web page that makes a request to my Folder. In the form of the page I have an input of type file and another of type text. The encoding…
java java-ee upload file-upload servletasked 6 years, 8 months ago Carlos Rafael de Oliveira Carn 50 -
1
votes1
answer311
viewsReason for delay of process and configuration of Hibernate (persistence)
I’m setting up a WS server with Java, and I’m seeing some problems, like login via POSTMAN, is taking between 6000 to 7500 ms to respond, and what it really does, is around 50 ms. After being able…
-
1
votes1
answer76
viewsWhat dependencies do I need on Gradle?
What are the necessary dependencies for the following libraries? import java.io.StringReader; import java.net.Authenticator; import java.net.PasswordAuthentication; import java.util.ArrayList;…
-
1
votes0
answers99
viewsProblems with Java Strings
Guys, I’m running a data migration from a csv file to an H2 database. In this process I use the beanio to read the file and transform it into objects and then persist the objects in the base using…
-
1
votes1
answer60
viewsFor don’t go through the whole list
I’m having a problem going through a list. Man for this way: for (int i = 0; i < listaCaixaAbertos().size(); i++) { listaCaixaAbertos().get(i).setFechado(Boolean.TRUE);…
-
1
votes0
answers139
viewsError in log4j2.properties configuration
My mistake: 2018-02-02 03:31:07,300 main ERROR The parameter is null: fileName 2018-02-02 03:31:07,316 main ERROR Could not create plugin of type class…
-
1
votes1
answer128
viewsMy BD search placed in a listview (Arrayadapter) returns the object address and not the content
I made an APP that saves the date and a series of numbers (8 numbers) in the Android database. I created an object ( with date and numbers), but when I search all objects inside the database and put…
-
1
votes0
answers200
viewsThreads and Interrupt();
I wonder how I can pause my Thread efficiently and correctly with the interrupt method(); I’m with a part of my class that I started, but I’d like to pause it. My project consists of a websocket,…
-
1
votes1
answer49
viewsHow do I kill a websocket?
I’m having a hard time kill the websocket that runs inside my java app, I can’t find answers anywhere. I need this, because I’m using it with a Chrome extension to fill out a website’s Forms, but…
-
1
votes1
answer451
viewsSelect from two tables. How to return a single list?
I have a Processes table, with basic data and another Processes highlight, with more specific data. I need to make a select that calls some columns of the basic data and others of the specific data.…
-
1
votes1
answer443
viewsEnter edit mode when typing something when Jtable’s cell is focused
I have a celleditor in the format of textarea, and when you’re focused, I squeeze some word to type in celula. It opens the edit mode, but does not write anything, which may be wrong? working class…
-
1
votes1
answer1329
viewsJAVA standard deviation
Here are my methods for calculating standard deviation, which for some reason unknown by me does not work (I left my test method down here as well). public strictfp Double…
-
1
votes1
answer512
viewsFirst() and next() methods do not work in Resultset, even when editing parameters
I need to do two iterations on the same ResultSet. For that I did the following: I set parameters in a Statement to make the cursor editable, according to my connection class constructor: public…
-
1
votes1
answer312
viewsIs concatenating values directly into the query problematic?
These days a guy told me: "avoid forming Sqls by concatenating pieces of Strings. To do this is to ask to have security problems with SQL injection, and for this reason is considered a bad…
-
1
votes0
answers113
viewsHow to make a Gradient Map (2 colors) in an Image?
I need a solution to turn the color of an image into black and white. There are 3 ways to do this, using Grayscale that technically plays white to gray, making the saturation stay -100 and through…
-
1
votes1
answer85
viewsHow to print only numbers that repeat between two different formulas?
I have two 50 number formulas. One has multiples of 3 and the other multiples of 7. Code: public static void main(String[] args) { BigInteger start = new BigInteger("1"); BigInteger limit = new…
-
1
votes1
answer671
viewsJava - Read file and Write output to . txt
I have an application to read a file. txt and seal specific columns and generate in the format I need, the application works, but the result is generated in the Netbeans console, then I copy the…
javaasked 6 years, 8 months ago Alex Basto 11 -
1
votes1
answer130
viewsAsynctask task execution timeout
How do I limit the running time of a Asynctask and return a warning when the limit is reached ? The method searches a json of a webservice, but the same may be out of the air, and when this happens…