Alex Rome

Greenhorn
+ Follow
since Aug 17, 2014
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Alex Rome

I fixed the issue about ConcurrentModificationException changing HashMap with ConcurrentHashMap but now when the ServletContextListener remove some keys from the map, when I print this map from the servlet, it prints all the keys, also the removed keys. Why?

EDIT: I fixed also the latest issue
4 years ago
I have two java classes, the first is a Servlet that register users access to the same servlet, the second class implements a ServletContextListener and update the HashMap removing the expired access.I need this Application to obtain a list of online users on an android app, so if you know an easiest way please tell me.

this is the code:



Servlet:


at the moment the application doesn't work fine, because the update doens't happen and after few minutes a ConcurrentModificationException occurs...
4 years ago
I solved the issue, in the MainActivity I used a static Fragment with very similiar name of my Fragment that I posted. FACEPALM
4 years ago

Ulf Dittmer wrote:Setting 2 event handlers (in lines 19 and 20) can't be right.

I removed one of the event handlers but I have the same problem, also the issue is on avatar ImageView on line 47, not on the button
4 years ago
I fixed this error changing the target in the "project.properties" file with:

target=android-19
4 years ago

Ulf Dittmer wrote:Have you ascertained that the event handler code is actually executed?

I inserted a Log in the onClick method and I found that the event handler insn't called, but why? The code seems ok
4 years ago

Ulf Dittmer wrote:

I use only the piece of code about the action, it doesn't work.


That was my earlier question: how does it not work? What did you do, what did you expect to happen as a result, and what happened instead? What concrete steps have you taken so far to investigate the issue?

The issue is that I haven't result because the image picker doesn't open from the fragment, if I click/touch the ImageView, nothing happens, instead with the same code in the Activity, the image picker opens and I can select an image from the gallery, so in this way I have the result. Using the fragment and reading the logcat, there isn't anything about the issue...It's a mistery
4 years ago

Ulf Dittmer wrote:I'm confused - earlier you said the code worked fine when part of an activity. But now it doesn't?

The first thing to investigate whenever an event handler seems to have no effect is to find out if it is ever actually called.

If I use all the code of the Fragment as Activity, the action works, instead if I use only the piece of code about the action, it doesn't work.

in this way works fine, but I need the same result with a fragment:

4 years ago

Ulf Dittmer wrote:My favorite approach for communication between various components of an app is the EventBus library.

Or you can cast getActivity() to whatever class it actually is, and then make a direct method call.

I used this code in the MainActivity but nothing happens if I click the ImageView:

4 years ago

Ulf Dittmer wrote:I wasn't suggesting that you don't use fragments, I'm suggesting that you do perform this action in the activity instead of the fragment.

how can I do this? My view is inside the fragment
4 years ago

Ulf Dittmer wrote:That may not be possible - what's the issue with having the associated activity do it instead?

I'm probably wrong understanding but I need to use a Fragment and not an Activity because I'm using the DrawerLayout in the MainActivity
4 years ago
I'm using an Activity with DrawerLayout (NavigationDrawer) that show a Fragment and this fragment has three EditText and a ImageView, if I click on ImageView it should open the image picker but nothing happens.

This is the code:



P.S: if I use the same code in a Activity class, the picker opens, but I need that it opens from a Fragment
4 years ago