我正在尝试Intent服务.这就是我用它来称呼它
Button updateLocation = (Button) findViewById(R.id.btnUpdateLocation); updateLocation.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Intent updateLocIntent=new Intent(ImTracking.this,UpdateLocation.class); startService(updateLocIntent);}});@H_403_3@但是在我的UpdateLocation类中,它永远不会碰到我的任何断点.
public class UpdateLocation extends IntentService{ public UpdateLocation() { super("UpdateLocation"); } @Override protected void onHandleIntent(Intent intent) { SharedPreferences prefs = getSharedPreferences("Settings",0); final String id = prefs.getString("ID",""); DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httpost = new HttpPost( "http://iphone-radar.com/gps/gps_locations"); JSONObject holder = new JSONObject(); ...@H_403_3@到底是怎么回事?
谢谢
PS.我正在使用它,因为我想用一个报警管理器来调用它.但是,在按钮单击时,我想显示一个进度对话框,我将在哪里放置意向服务的进度对话框? (到目前为止,我只有使用异步任务的经验)
解决方法
你在AndroidManifest.xml中有
declare your service吗?除非声明如下,否则不会调用它:
<manifest ... > ... <application ... > <service android:name=".ExampleService" /> ... </application> </manifest>@H_403_3@