I am new to android. I did write some app before, and they all run well. However, this app run very slow that normal. E.g. When I click on the setting, it take 4s to appear. Here is the log
I/Choreographer: Skipped 41 frames! The application may be doing too much work on its main thread.
I/Choreographer: Skipped 42 frames! The application may be doing too much work on its main thread. I/Choreographer: Skipped 53 frames! The application may be doing too much work on its main thread. I/Choreographer: Skipped 89 frames! The application may be doing too much work on its main thread.
My activity pretty simple. It just check if the user was login or not. And then it will get the user name on the SharedPreferences
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mNotLoginTextView = (TextView) findViewById(R.id.notLoginTextView);
prefs = getSharedPreferences(STUDENT_PREFS, 0);
int id = prefs.getInt("studentId", 0); // if not, id = 0
if(id == 0)
{
mNotLoginTextView.setText(R.string.not_login);
mNotLoginTextView.setEnabled(true);
}
else
{
String lastName = prefs.getString("lastName", null);
String firstName = prefs.getString("firstName", null);
mNotLoginTextView.setText("Have a nice day " + firstName + " " + lastName);
mNotLoginTextView.setTextSize(18);
}
}
Thank you for your help.
Update: The answer on the question at the link above is not work on my case
I didn't use fragment to create the setting menu, so that it cause to this problem. After create fragment for the setting menu, it work faster than ever.