Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialIkuyasu Usui
36 PointsThe app hangs up second time it gets refreshed when implemented with setOnClickListener.
I implemented onClick functionality using setOnClickListener like the below, but it allows me to refresh one time, but when I try again, the app hangs up, becomes non-responsive.
private ImageView refreshImageView;
...
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getForecast(latitude, longitude);
refreshImageView = findViewById(R.id.refreshImage);
refreshImageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
refreshOnClick(view);
}
});
When using android:onClick="refreshOnClick", it works. I can refresh many times. I don't know why this happens.
Ikuyasu Usui
36 PointsIkuyasu Usui
36 PointsLooking at logcat, I get
"2019-01-15 11:25:04.768 1961-1984/system_process I/GnssLocationProvider: WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@e2bf1ec) "
many many times with verbose mode.