I detected a memory leak using Samsung devices. If any activity has an EditText , this activity will flow. To show this, I created small test applications.
The first Activity (called MyActivity ) contains EditText and Button . By clicking the button, you call the finish () first of Activity and open the second.
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); findViewById(R.id.goTo)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); Intent intent = new Intent(MyActivity.this, AnotherActivity.class); startActivity(intent); } }); }
When I do the second activity, I take hprof. From the memory analyzer, I see that MyActivity leaked due to a link from InputMethodManager

This issue only occurs on Samsung S III and Tab devices. Thus, there is no leak in the device of Xperia P and others. Please help get around this error.
android memory memory-leaks
Robert
source share