Reputation: 99
my app is just at starting mode but does not load completely the Logcat Message is : "Skipped 33 frames! The application may be doing too much work on its main thread." please help me ..
Upvotes: 1
Views: 96
Reputation: 3426
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Log.d("in on create", "before thread");
new handler().start();
}
private class handler extends Thread {
@Override
public synchronized void start() {
super.start();
Log.d("in handler ", "inside start");
}
}
}
Upvotes: 1
Reputation: 1844
Please let me know if you are doing some network operation, Bitmap downloading and setting on ImageViews iteratively. This consumes much memory to be done So this kind of issues raised.
In case of Bitmap downloading and setting to imageView you should resize images as per imageView (eg. list image-icons in ListView).
Upvotes: 0
Reputation: 6128
Use Async Task to run the tasks in background.
Here is a example :
http://android-am.blogspot.in/2012/10/async-task-with-progress-dialog-in.html
Upvotes: 0
Reputation: 3426
If you really think that is doing all of the work on UI Thread. then just do create a Thread object and make your function calls in its run()
Thread t=new Thread();
t.start();
public void run(){
makeYourFunctionCallHere();
}
or you can use ASysncTask if doing some network operation.
Upvotes: 0