Here I make call to an activity, which is a chat application.
The catLog:
02-26 12:30:38.996: I/Choreographer(807): Skipped 35 frames! The application may be doing too much work on its main thread. 02-26 12:30:39.196: I/Choreographer(807): Skipped 31 frames! The application may be doing too much work on its main thread. 02-26 12:30:39.516: I/Choreographer(807): Skipped 31 frames! The application may be doing too much work on its main thread. 02-26 12:30:39.996: I/Choreographer(807): Skipped 32 frames! The application may be doing too much work on its main thread. 02-26 12:30:40.066: I/Choreographer(807): Skipped 37 frames! The application may be doing too much work on its main thread. 02-26 12:30:40.207: I/Choreographer(807): Skipped 33 frames! The application may be doing too much work on its main thread. 02-26 12:30:40.896: I/Choreographer(807): Skipped 33 frames! The application may be doing too much work on its main thread. 02-26 12:30:41.586: I/Choreographer(807): Skipped 30 frames! The application may be doing too much work on its main thread. 02-26 12:30:42.266: I/Choreographer(807): Skipped 30 frames! The application may be doing too much work on its main thread. 02-26 12:30:42.486: I/Choreographer(807): Skipped 31 frames! The application may be doing too much work on its main thread. 02-26 12:30:42.556: I/Choreographer(807): Skipped 37 frames! The application may be doing too much work on its main thread. 02-26 12:30:42.826: I/Choreographer(807): Skipped 32 frames! The application may be doing too much work on its main thread. 02-26 12:30:43.316: I/Choreographer(807): Skipped 30 frames! The application may be doing too much work on its main thread. 02-26 12:30:43.777: I/Choreographer(807): Skipped 30 frames! The application may be doing too much work on its main thread. 02-26 12:30:43.826: I/Choreographer(807): Skipped 32 frames! The application may be doing too much work on its main thread. 02-26 12:30:43.866: I/Choreographer(807): Skipped 34 frames! The application may be doing too much work on its main thread. . . . . . . . . . . . . . . .
This is how I start the activity from MainActivity:
public class MainActivity extends Activity { Handler handler; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button b = (Button) findViewById(R.id.button1); handler = new Handler(Looper.getMainLooper()); b.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { final Intent i = new Intent(com.example.mainactivity.MainActivity.this,com.quickblox.sample.chat.ui.activities.SplashActivity.class); handler.post(new Runnable() { @Override public void run() { startActivity(i); } });
How can I prevent this,the app hangs after calling the activity.Whats wrong?
UPDATE:
SplashActivity:
public class SplashActivity extends Activity implements QBCallback { private static final String APP_ID = "7467"; private static final String AUTH_KEY = "TxRFWfX8tTXQ4gv"; private static final String AUTH_SECRET = "y-QJrO2j69VTaCs"; private ProgressBar progressBar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); progressBar = (ProgressBar) findViewById(R.id.progressBar); QBSettings.getInstance().fastConfigInit(APP_ID, AUTH_KEY, AUTH_SECRET); QBAuth.createSession(this); } @Override public void onComplete(Result result) { progressBar.setVisibility(View.GONE); if (result.isSuccess()) { Intent intent = new Intent(this, MainActivity.class); startActivity(intent); finish(); } else { AlertDialog.Builder dialog = new AlertDialog.Builder(this); dialog.setMessage("Error(s) occurred. Look into DDMS log for details, " + "please. Errors: " + result.getErrors()).create().show(); } } @Override public void onComplete(Result result, Object context) { } }
UPDATE :
You can find Details in this thread.