Created
December 7, 2016 08:37
-
-
Save Rangor/ba014dae4bf97b287897d526902d5cbd to your computer and use it in GitHub Desktop.
Android memory testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MemoryTesterActivity extends AppCompatActivity { | |
List<String> memoryHog; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_memory_tester); | |
memoryHog = new ArrayList<>(); | |
for(double i = 0; i < 1000000; i++){ | |
String number = Double.toString(i); | |
memoryHog.add(number); | |
} | |
} | |
public void asynctaskexecute(View target){ | |
new MyAsyncTask().execute(); | |
} | |
private class MyAsyncTask extends AsyncTask { | |
@Override | |
protected Object doInBackground(Object[] params) { | |
return doSomeStuff(); | |
} | |
private Object doSomeStuff() { | |
//do something to get result | |
return new Object(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment