In my main Activity's onCreate
method, I've started a Intent
using the following code:
Intent intent = new Intent(this, NetworkHandler.class);
startService(intent);
I've created another class named NetworkHandler which extends the IntentService
public class NetworkHandler extends IntentService {
public NetworkHandler() {
super("HTTPRequest");
// TODO Auto-generated constructor stub
}
@Override
protected void onHandleIntent(Intent intent) {
String url = "http://vlm1.uta.edu/~zhangzhong/questions.json";
Toast.makeText(intent.getComponent(), "Debug!", Toast.LENGTH_LONG).show();
DefaultHttpClient client = new DefaultHttpClient();
The problem is I'm trying to use the Toast
in the NetworkHandler
class. I'd like to pass the main activity object to the first parameter of makeText
method of Toast
. How can I do it?