android保存图片后加了以下代码就可以了
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE,Uri
.parse("file://" + _file)));
那么这个sendBroadcast到底是做什么的呢?广播,相当于iOS中NSNotificationCenter的postNotificationName。不过比iOS更加强大,iOS中只是app内适用,在android中发送一条广播其他app都可以收到,然后进行相应的处理。 发送广播比较android
Intent it = new Intent("someNotification");
it.putExtra("some argv", "abcd");
sendBroadcast(it);
iOS [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingTaskDidCompleteNotification object:task userInfo:userInfo]; 接收广播比较android
private BroadcastReceiver br = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String someargv = intent.getStringExtra("some argv");
}
};
IntentFilter ifilter = new IntentFilter("someNotification");
registerReceiver(br, ifilter);
iOS
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidFinish:) name:AFNetworkingTaskDidCompleteNotification object:nil];
- (void)networkRequestDidFinish:(NSNotification *)notification {
NSDictionary * userDic = [notification userInfo];
//some code
}
取消接收广播比较android registerReceiver(br, ifilter); iOS [[NSNotificationCenter defaultCenter] removeObserver:self]; 总结
附app效果图 |



ecshop红色综合商城(推荐
人气:1599
ecshop仿京东2012免费模板整
人气:10144
SuperShop外贸综合通用mage
人气:181
ecshop蓝色冰爽妆品模板
人气:611
ecshop仿钻石小鸟2016整站模
人气:932
绿色asp企业网站源码生成
人气:404