Reputation: 415
I have an android application which starts with ItemListActivity
class and in onCreate()
method I check if user is logged in to app or not (Based on a saved value in sharedPreferences) and if not logged in I change activity to content_main
activity:
if (!SharedPreferencesUtils.sharedPrefHasString(getApplicationContext(),userIDKey,null)){
Intent intent = new Intent(getApplicationContext(),content_main.class);
startActivity(intent);
finish();
return;
}
and in content_main
activity I have simply 2 EditText
s to get users email and password.
Every thing works fine untill I click on any Edittext, then it starts draining memory and crashes with this log:
java.lang.OutOfMemoryError: Failed to allocate a 35469582 byte allocation with 16769200 free bytes and 24MB until OOM
.
I'm dealing with this for couple of days and I've read that It occurs when you use edittext in relativeLayout so I changed the layout to LinearLayout and it didn't work either. My device is Samsung galaxy s5 and android version is 6.0.1
And I keep getting this error when ever I click on any EditText. And here is my Android profiler memory view: Is there any idea what causes this problem?
Upvotes: 1
Views: 113
Reputation: 24907
There are some issues in Advance Android profiler. You need to disable it as follows:
Go to run/debug configuration -> Profiling -> Uncheck Enable advanced profiling
Upvotes: 1