Category "java"

Why my RecyclerView updated while I don't notify the adapter?

I have some trouble to understand why my recyclerView get update while I add the data only after setAdapter() and never call notifyDataSetChanged() ! In the sa

Do variables/flags can be affected by another thread on a non-synchronized method?

For example I have a non-synchronized method like this: public void nonSynchronized(){ boolean flag = false; if(/*some condition*/){ flag

java.lang.ClassCastException class xxxxx cannot be cast to class io.micronaut.data.model.Page Micronaut data

Trying to implement the pagination with Micronaut data with MongoDB as below @MongoRepository public interface IDiscountRepository extends ReactorCrudRepository

How to enable assertions in the Gradle run task

By default, Java disables assertions. (The test I'm using here is assert false; as the first line in main().) I'd like to have them enabled while running my p

Error java.lang.AssertionError: expected: null<null> but was: java.lang.String<null> what does it mean?

I have this strange issue in my Junit 4.12 test code. The application uses Spring Framework 4.1.6 and Hibernate 4. When comparing two beans coming from differen

Mockito when() method not working and getting null pointer exception

I am writing unit test cases using Mockito and JUnit . But getting NullPointerException when running a test. On debugging I get to know that Mockito on method:

how to make overlay window view clickable and touchable in android

I am trying to learn how to create an overlay window similar to Facebook chat head messenger icon in Android. I managed to create the following class which ena

React Native: 'compileJava' task (current target is 1.8) and 'compileKotlin' task (current target is 11) jvm target compat

Hello everyone I am trying to create and run a react native app. I run npx react-native init rn4 but when I run npm run android I have this error: > Task :re

How to check whether a known uri file exists in Android storage?

The file uri is known, such as `file:///mnt/sdcard/Download/AppSearch_2213333_60.apk` I want to check if this file can open or not in background, how to do?

Reading from a .txt file into a JFrame

I'm stuck trying to figure out how to read from a Java file into a JFrame. I need to make a frame and read in the names of cars and how much they cost. From the

Dynamic Programming (Codility Q: NumberSolitaire)

This is the question: codility.com/programmers/task/number_solitaire and below link is my result (50% from Codility): https://codility.com/demo/results/trainin

Static method behavior in multi-threaded environment in java

class Clstest{ public static String testStaticMethod(String inFileStr) { // section 0 // section 1 // do

The constructor WebDriverWait(chromeDriver, int) is undefined [closed]

WebDriverWait is not recognized even though it is imported in the eclipse IDE. Does anyone know the possible reason and fix for this?

Fortify file path manipulation solution recommendation

I'm creating a new file as classpath resource. With the following code, there are critical and high level Path Manipulation issues on Fortify. public class A {

PostgreSQL Exception: "An I/O error occured while sending to the backend"

I am testing some code which processes registration to a website. The java code is as follows (excerpt): if (request.getParameter("method").equals("checkEmail"

Can someone provide a good explanation of Dagger 2?

I'm really having a hard time understanding the Dagger 2 Dependency injection system. I understand the use of the @Inject annotation to tell Dagger we need to

How to use greater than and less than in a single if statement in Java

I made a BMI calculator. One of the things I have to do is add categories using if statements. 18.5 to 24.9 normal weight so that would be one of the categories

Unmarshalling an XML using Xpath expression and jaxb

I am new to JAXB and would like to know if there is a way by which I can unmarshall an XML to my response object but using xpath expressions. The issue is that

How to run Maven Checkstyle plugin on modified files only

I am running Maven Checkstyle plugin through pre-commit githook written in python (I think that the same question applies to running it directly from terminal).

How to hook into a method with int[] using xposed?

I am trying to hook into this method in NotificationManagerService using Xposed: void enqueueNotificationInternal(final String pkg, final String opPkg, final i