I’m trying to upload the contacts on a different Thread, I’m getting the application context but it seems not to work. Why?
Here’s the code:
private void uploadall() {
new Thread(new Runnable() {
public void run() {
Contacts contacts = new Contacts(getApplicationContext());
contacts.phoneandname();
// Apps
ListApps mList = new ListApps();
mList.loadInstalledApps(false, getApplicationContext());
}
});
}
And when I try to upload without the thread it works perfectly… Why?
You’re not actually starting the thread, try the following:
The Oracle concurrency tutorial is quite a good resource when starting out with multi-threading in Java and can be found here.