difference between android intents
what's the difference between an intent used for startActivity() and an
intent used for sendBroadcast() method. in a tutorial i found an way for
dynamially registering a broadcast receiver. and for this purpose i was
needed to provide a string as my intent name. how to choose an intent name
in this case and use for sendBroadcast() or registerReceiver() ?
should i add something to my android_manifest.xml file?according to the
tutorial currently i have declared an intent name like this
private static final String SEARCH_ACTION =
"com.example.usingwebservices.rest.SEARCH";
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
unregisterReceiver(receiver);
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
registerReceiver(receiver, new IntentFilter(SEARCH_ACTION));
}
private BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
if(progress!=null){
progress.dismiss();
}
String response = intent.getStringExtra(RestTask.HTTP_RESPONSE);
result.setText(response);
}
};
No comments:
Post a Comment