Skip to content
Advertisement

How to fix the Issue with replacing AsyncTask to connect socket?

I’m trying to use This approach(Marked Answer) to replace my code with AsyncTask to make connection between user in android and server, And here’s what I’ve done : Note: I’m not using any specific pattern, just trying to achieve this goal on a basic structure. MainActivity : ClientConnection : ConnectionTask : ConnectionRunningTask: So base on the above code I’ll try

What code solution to these ranges in java [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year. Improve this question Hello I would like to make a method that takes a given weight and windspeed and picks the right kite. The

Avoiding circular depenency between Arena and Portal

I’m trying to resolve this ciruclar dependency while preferebly keeping both objects immutable. Basically, I need portal to be able to activate itself, and start the arena. Opposite, I need Arena to reset & close itself, and the portal. I found a solution by having two HashMap’s <Arena, Portal> and <Portal, Arena>, however I want to figure out if it’s

How to send variable to method through an arraylist

I’m not very good at explaining things but can someone try to explain to me why my user input variables are not being sent to my methods in another class? This is my main class: } This is an example of one of my subclasses that I am trying to send the variables to. All the other ones are the

How to replace all substrings?

I want to replace all the text within brackets to uppercase letters for any String object. For example if the text is – Hi (abc), how (a)re (You)?” , output should be – Hi ABC, how Are YOU? . I tried to use StringUtils.SubstringBetween(), but that replaces only the first substring between (). Using regex, I suppose the group() method

Conserving RAM in java by using references to objects

I know some about java, and a lot about the lower level functions of a computer, so I’m always looking for ways to conserve ram. I’m also a fan of dwarf fortress, so I’ve been trying to get some similar system working. So, what I want to do is to make multiple tiles, assign them some type of material, and

How to reduce Optionals to throw an error once

I have the following response coming from a rest call and performing some logic based on what is returned. This is what I want. If the overall status code is NOT 200 OR If within the list of SimpleResponse, none of the SimpleResponse objects has a 200 httpCode, throw an error. The example below is incomplete. Too much going on

Advertisement