forked from huyongli/huyongli.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Android调用相机无法执行onActivityResult或data为null.html
662 lines (488 loc) · 40.6 KB
/
Android调用相机无法执行onActivityResult或data为null.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
<!DOCTYPE html>
<html lang=zh>
<head>
<meta charset="utf-8">
<title>Android调用相机无法执行onActivityResult或data为null | 老胡</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="description" content="最近项目中调用系统相机时遇到了这么个问题:红米手机无法执行onActivityResult回调,部分华为手机无法获取到照片数据,最后各种分析,各种网上搜索资料折腾了好久,最后终于把问题解决,当看到问题的最终原因时,我也是醉了,简直就是坑爹坑大发了。
最开始用红米手机调用系统相机的时,当我拍照完成点击那个勾勾始终无法返回到前面的界面上,也就是无法调用onActivityResult函数取到拍照的照片">
<meta property="og:type" content="article">
<meta property="og:title" content="Android调用相机无法执行onActivityResult或data为null">
<meta property="og:url" content="http://ittiger.cn/Android调用相机无法执行onActivityResult或data为null.html">
<meta property="og:site_name" content="老胡">
<meta property="og:description" content="最近项目中调用系统相机时遇到了这么个问题:红米手机无法执行onActivityResult回调,部分华为手机无法获取到照片数据,最后各种分析,各种网上搜索资料折腾了好久,最后终于把问题解决,当看到问题的最终原因时,我也是醉了,简直就是坑爹坑大发了。
最开始用红米手机调用系统相机的时,当我拍照完成点击那个勾勾始终无法返回到前面的界面上,也就是无法调用onActivityResult函数取到拍照的照片">
<meta property="og:updated_time" content="2016-07-29T01:19:10.953Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Android调用相机无法执行onActivityResult或data为null">
<meta name="twitter:description" content="最近项目中调用系统相机时遇到了这么个问题:红米手机无法执行onActivityResult回调,部分华为手机无法获取到照片数据,最后各种分析,各种网上搜索资料折腾了好久,最后终于把问题解决,当看到问题的最终原因时,我也是醉了,简直就是坑爹坑大发了。
最开始用红米手机调用系统相机的时,当我拍照完成点击那个勾勾始终无法返回到前面的界面上,也就是无法调用onActivityResult函数取到拍照的照片">
<link rel="alternate" href="atom.xml" title="老胡" type="application/atom+xml" />
<link rel="stylesheet" href="/libs/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="/libs/open-sans/styles.css">
<link rel="stylesheet" href="/libs/source-code-pro/styles.css">
<link rel="stylesheet" href="/css/style.css">
<script src="/libs/jquery/2.1.3/jquery.min.js"></script>
<link rel="stylesheet" href="/libs/lightgallery/css/lightgallery.min.css">
<link rel="stylesheet" href="/libs/justified-gallery/justifiedGallery.min.css">
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "//hm.baidu.com/hm.js?5e886c0a11c8dce0abbe888faadd1000";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
</head>
<body>
<div id="container">
<header id="header">
<div id="header-main" class="header-inner">
<div class="outer">
<a href="/" id="logo">
<i class="logo"></i>
<span class="site-title">老胡</span>
</a>
<nav id="main-nav">
<a class="main-nav-link" href="/.">主页</a>
<a class="main-nav-link" href="/archives">归档</a>
<a class="main-nav-link" href="/categories">分类</a>
<a class="main-nav-link" href="/tags">标签</a>
<a class="main-nav-link" href="/about">关于</a>
<a class="main-nav-link" href="/website">干货</a>
</nav>
<nav id="sub-nav">
<div class="profile" id="profile-nav">
<a id="profile-anchor" href="javascript:;">
<img class="avatar" src="/css/images/avatar.png" />
<i class="fa fa-caret-down"></i>
</a>
</div>
</nav>
<div id="search-form-wrap">
<form class="search-form">
<input type="text" class="ins-search-input search-form-input" placeholder="搜索" />
<button type="submit" class="search-form-submit"></button>
</form>
<div class="ins-search">
<div class="ins-search-mask"></div>
<div class="ins-search-container">
<div class="ins-input-wrapper">
<input type="text" class="ins-search-input" placeholder="想要查找什么..." />
<span class="ins-close ins-selectable"><i class="fa fa-times-circle"></i></span>
</div>
<div class="ins-section-wrapper">
<div class="ins-section-container"></div>
</div>
</div>
</div>
<script>
(function (window) {
var INSIGHT_CONFIG = {
TRANSLATION: {
POSTS: '文章',
PAGES: '页面',
CATEGORIES: '分类',
TAGS: '标签',
UNTITLED: '(未命名)',
},
ROOT_URL: '/',
CONTENT_URL: '/content.json',
};
window.INSIGHT_CONFIG = INSIGHT_CONFIG;
})(window);
</script>
<script src="/js/insight.js"></script>
</div>
</div>
</div>
<div id="main-nav-mobile" class="header-sub header-inner">
<table class="menu outer">
<tr>
<td><a class="main-nav-link" href="/.">主页</a></td>
<td><a class="main-nav-link" href="/archives">归档</a></td>
<td><a class="main-nav-link" href="/categories">分类</a></td>
<td><a class="main-nav-link" href="/tags">标签</a></td>
<td><a class="main-nav-link" href="/about">关于</a></td>
<td><a class="main-nav-link" href="/website">干货</a></td>
<td>
<div class="search-form">
<input type="text" class="ins-search-input search-form-input" placeholder="搜索" />
</div>
</td>
</tr>
</table>
</div>
</header>
<div class="outer">
<aside id="profile">
<div class="inner profile-inner">
<div class="base-info profile-block">
<img id="avatar" src="/css/images/avatar.png" />
<h2 id="name">老胡</h2>
<h3 id="title">Android Developer</h3>
<span id="location"><i class="fa fa-map-marker"></i>WuHan, China</span>
<a id="follow" target="_blank" href="https://github.com/huyongli/">关注我</a>
</div>
<div class="article-info profile-block">
<div class="article-info-block">
49
<span>文章</span>
</div>
<div class="article-info-block">
47
<span>标签</span>
</div>
</div>
<div class="profile-block social-links">
<table>
<tr>
<td>
<a href="http://github.com/huyongli" target="_blank" title="github" class=tooltip>
<i class="fa fa-github"></i>
</a>
</td>
<td>
<a href="http://weibo.com/aclaohu" target="_blank" title="weibo" class=tooltip>
<i class="fa fa-weibo"></i>
</a>
</td>
<td>
<a href="/atom.xml" target="_blank" title="rss" class=tooltip>
<i class="fa fa-rss"></i>
</a>
</td>
</tr>
</table>
</div>
</div>
</aside>
<section id="main"><article id="post-Android调用相机无法执行onActivityResult或data为null" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-inner">
<header class="article-header">
<h1 class="article-title" itemprop="name">
Android调用相机无法执行onActivityResult或data为null
</h1>
<div class="article-meta">
<div class="article-date">
<i class="fa fa-calendar"></i>
<a href="/Android调用相机无法执行onActivityResult或data为null.html">
<time datetime="2015-09-26T13:44:09.000Z" itemprop="datePublished">2015-09-26</time>
</a>
</div>
<div class="article-category">
<i class="fa fa-folder"></i>
<a class="article-category-link" href="/categories/Android/">Android</a>
</div>
<div class="article-tag">
<i class="fa fa-tag"></i>
<a class="tag-link" href="/tags/Android/">Android</a>, <a class="tag-link" href="/tags/相机/">相机</a>
</div>
</div>
</header>
<div class="article-entry" itemprop="articleBody">
<p>最近项目中调用系统相机时遇到了这么个问题:红米手机无法执行onActivityResult回调,部分华为手机无法获取到照片数据,最后各种分析,各种网上搜索资料折腾了好久,最后终于把问题解决,当看到问题的最终原因时,我也是醉了,简直就是坑爹坑大发了。</p>
<p>最开始用红米手机调用系统相机的时,当我拍照完成点击那个勾勾始终无法返回到前面的界面上,也就是无法调用onActivityResult函数取到拍照的照片,在网上搜索了一圈,没找到解决办法,都说是红米的系统问题,无法解决,项目比较紧张,刚好客户的手机全部是统一型号的华为荣耀6Plus,这个问题丢着暂时没管了。<br>后来现场同事批量测试机器时,发现有3台手机可以拍照,但是在onActivityResult回调中获取到的照片数据为null,但是其他的同型号手机又没这个问题,这问题看着真是坑爹啊。</p>
<a id="more"></a>
<p>远程调试代码后发现,我在调用系统相机时设置的照片存放目录无法创建成功,我调用系统相机的代码如下:<br><figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">takePicture</span><span class="params">()</span> </span>{</div><div class="line"> <span class="comment">//照片存放目录</span></div><div class="line"> File file = <span class="keyword">new</span> File(mPicDirectory);</div><div class="line"> <span class="keyword">if</span>(!file.exists()) {<span class="comment">//目录不存在则创建该目录及其不存在的父目录</span></div><div class="line"> file.mkdirs();</div><div class="line"> }</div><div class="line"> Intent intent = <span class="keyword">new</span> Intent(MediaStore.ACTION_IMAGE_CAPTURE);</div><div class="line"> mPicName = getPictureName();<span class="comment">//获取照片名称</span></div><div class="line"> mPicPath = mPicDirectory + mPicName;<span class="comment">//照片存储路径</span></div><div class="line"> <span class="comment">//将照片保存到mPicPath位置</span></div><div class="line"> intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(<span class="keyword">new</span> File(mPicPath)));</div><div class="line"> startActivityForResult(intent, CODE_RESULT_TAKE_PHOTO);</div><div class="line">}</div></pre></td></tr></table></figure></p>
<p>我调试的时候在onActivityResult回调里通过照片路径获取Bitmap对象的时候发现获取到的Bitmap对象一直为null,所以就猜想是不是照片没保存成功,我在文件管理系统里去找这个照片的时候发现,连照片存储目录mPicDirectory都不存在,我再次跟踪代码发现file.mkdirs()始终返回的都是false。看来问题的最终原因是这个:无法创建目录和文件(华为手机系统在拍照输出的时候,如果输出文件路径不存在时竟然没有任何提示和异常,这点对于发现问题的根源有点困难)。然后我又去检查了权限、手机设置里面的权限等所有有可能涉及的问题,结果依然没有效果。既然这些都不是导致目录创建失败的原因,那会不会是目录路径本身不正确呢,我的目录路径是这样获取的:</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div></pre></td><td class="code"><pre><div class="line">String mPicDirectory = FileManager.getPath() + Configuration.SYS_PHOTO_PATH;</div><div class="line"> </div><div class="line"><span class="comment">//FileManager的部分代码是这样的,这个代码是以前的同事写的,没有细看过:</span></div><div class="line"> </div><div class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> String <span class="title">getPath</span><span class="params">()</span></span>{</div><div class="line"> </div><div class="line"><span class="keyword">boolean</span> sdCardExist = Environment.getExternalStorageState()</div><div class="line"> .equals(android.os.Environment.MEDIA_MOUNTED); <span class="comment">//判断sd卡是否存在 </span></div><div class="line"><span class="keyword">return</span> !sdCardExist ? MOBILE_PATH : SD_PATH;</div><div class="line">}</div><div class="line"> </div><div class="line"><span class="comment">//sdcard路径</span></div><div class="line"><span class="keyword">private</span> <span class="keyword">static</span> String SD_PATH = Environment.getExternalStorageDirectory().getAbsolutePath();</div><div class="line"> </div><div class="line"><span class="comment">//应用数据路径</span></div><div class="line"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">final</span> String MOBILE_PATH = Environment.getDataDirectory().getAbsolutePath();</div><div class="line"> </div><div class="line"><span class="comment">//这里有一段静态代码块</span></div><div class="line"><span class="keyword">static</span>{</div><div class="line"> File f = <span class="keyword">new</span> File(<span class="string">"/storage/sdcard1"</span>);</div><div class="line"> <span class="keyword">if</span>(f.exists()){</div><div class="line"> <span class="keyword">long</span> size = getFreeSize(<span class="string">"/storage/sdcard1"</span>);</div><div class="line"> <span class="keyword">long</span> sd0Size = getFreeSize(<span class="string">"/storage/sdcard0"</span>);</div><div class="line"> <span class="keyword">if</span>(size > sd0Size){</div><div class="line"> SD_PATH = <span class="string">"/storage/sdcard1"</span>;</div><div class="line"> }</div><div class="line"> }</div><div class="line">}</div></pre></td></tr></table></figure>
<p>当我看到上面的静态代码块的时候,我立马就知道了问题的原因,静态代码块中做了一个剩余空间判断,选取的是空间比较大的那个sdcard路径,而且代码都是写死的<br><code>Environment.getExternalStorageDirectory().getAbsolutePath()</code>系统这个代码是获取手机里的内置SDCard的路径,我的红米手机自己又额外插了一张内存卡,这个是手机的外接SDCard,用<code>Environment.getExternalStorageDirectory()</code>获取到只是手机自带的外置SDCard路径,不能获取自己插入的内存卡路径,我的手机通过<code>Environment.getExternalStorageDirectory()</code>方式获取的路径是<code>/storage/sdcard0</code>(我手机内置的SDCard),而通过可用空间比较之后发现该卡的可用空间少于<code>/storage/sdcard1</code>(我自己插入的SDCard),所以最终路径变成了<code>/storage/sdcard1</code>,而在Android4.4以上后,不允许三方App对外接的SDCard进行操作,因此我们队最后得到的这个目录是没有写入权限的,所以我创建照片存储目录的时候一直失败,所以拍照的时候照片数据没有地方可以输出,华为手机是直接体现在照片数据无法获取,而红米手机则是直接不允许返回到前面的调用界面。</p>
<p>Google在Android中限制三方App操作外接SDCard的原文如下:</p>
<blockquote>
<p>The WRITE_EXTERNAL_STORAGE permission must only grant write access to the primary external storage on a device. Apps must not be allowed to write to secondary external storage devices, except in their package-specific directories as allowed by synthesized permissions.</p>
</blockquote>
<p>后来想了想,调用相机这么简单的一个功能,红米的系统应该不可能给阉割掉,所以出了问题还是老老实实的先找自己代码的问题吧。至于那个外接SDCard的写入权限还有待寻找答案。</p>
<p>系统内置SDCard写入、删除、读写权限:</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">//文件创建、删除权限</div><div class="line"><span class="tag"><<span class="name">uses-permission</span> <span class="attr">android:name</span>=<span class="string">"android.permission.MOUNT_UNMOUNT_FILESYSTEMS"</span> /></span></div><div class="line">//文件读写权限,只针对于手机内存的SDCard,对外接SDCard无效</div><div class="line"><span class="tag"><<span class="name">uses-permission</span> <span class="attr">android:name</span>=<span class="string">"android.permission.WRITE_EXTERNAL_STORAGE"</span> /></span></div></pre></td></tr></table></figure>
<hr>
<p>原创文章,本文采用<a href="https://creativecommons.org/licenses/by/2.5/cn/" target="_blank" rel="external">知识共享署名 2.5(中国大陆许可协议)</a>进行许可,欢迎转载,但转载请注明来自<a href="ittiger.cn">ittiger.cn</a>,并保证转载后文章内容的完整性。本人(laohu)保留所有版权相关权利。</p>
</div>
<!-- 打赏 -->
<!-- css -->
<style type="text/css">
.center {
text-align: center;
}
.hidden {
display: none;
}
.donate_bar a.btn_donate{
display: inline-block;
width: 82px;
height: 82px;
background: url("http://7xsl28.com1.z0.glb.clouddn.com/btn_reward.gif") no-repeat;
_background: url("http://7xsl28.com1.z0.glb.clouddn.com/btn_reward.gif") no-repeat;
<!-- http://img.t.sinajs.cn/t5/style/images/apps_PRF/e_media/btn_reward.gif
因为本 hexo 生成的博客所用的 theme 的 a:hover 带动画效果,
为了在让打赏按钮显示效果正常 而 添加了以下几行 css,
嵌入其它博客时不一定要它们。 -->
-webkit-transition: background 0s;
-moz-transition: background 0s;
-o-transition: background 0s;
-ms-transition: background 0s;
transition: background 0s;
<!-- /让打赏按钮的效果显示正常 而 添加的几行 css 到此结束 -->
}
.donate_bar a.btn_donate:hover{ background-position: 0px -82px;}
.donate_bar .donate_txt {
display: block;
color: #9d9d9d;
font: 14px/2 "Microsoft Yahei";
}
.bold{ font-weight: bold; }
</style>
<!-- /css -->
<!-- Donate Module -->
<div id="donate_module">
<!-- btn_donate & tips -->
<div id="donate_board" class="donate_bar center">
<br>
<br>
<a id="btn_donate" class="btn_donate" target="_self" href="javascript:;" title="Donate 打赏"></a>
<span class="donate_txt">
对你有帮助?求鼓励,求支持!
</span>
</div>
<!-- /btn_donate & tips -->
<!-- donate guide -->
<div id="donate_guide" class="donate_bar center hidden">
<br>
<br>
<a href="http://ittiger.cn/img/weixinpay.png" title="用微信扫一扫哦~" class="fancybox" rel="article0">
<img src="http://ittiger.cn/img/weixinpay.png" title="微信打赏 Colin" height="200px" width="auto"/>
</a>
<a href="http://ittiger.cn/img/alipay.png" title="用支付宝扫一扫即可~" class="fancybox" rel="article0">
<img src="http://ittiger.cn/img/alipay.png" title="支付宝打赏 Colin" height="200px" width="auto"/>
</a>
<span class="donate_txt">
对你有帮助?求鼓励,求支持!
</span>
</div>
<!-- /donate guide -->
<!-- donate script -->
<script type="text/javascript">
document.getElementById('btn_donate').onclick = function() {
$('#donate_board').addClass('hidden');
$('#donate_guide').removeClass('hidden');
}
function donate_on_web(){
$('#donate').submit();
}
var original_window_onload = window.onload;
window.onload = function () {
if (original_window_onload) {
original_window_onload();
}
document.getElementById('donate_board_wdg').className = 'hidden';
}
</script>
<!-- /donate script -->
</div>
<br>
<br>
<!-- /Donate Module -->
<!-- 打赏 -->
<footer class="article-footer">
<div class="share-container">
<div class="bdsharebuttonbox">
<a href="#" class="bds_more" data-cmd="more">分享到:</a>
<a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间">QQ空间</a>
<a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博">新浪微博</a>
<a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博">腾讯微博</a>
<a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网">人人网</a>
<a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信">微信</a>
</div>
<script>
window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{"bdSize":16}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];
</script>
<style>
.bdshare_popup_box {
border-radius: 4px;
border: #e1e1e1 solid 1px;
}
.bdshare-button-style0-16 a,
.bdshare-button-style0-16 .bds_more {
padding-left: 20px;
margin: 6px 10px 6px 0;
}
.bdshare_dialog_list a,
.bdshare_popup_list a,
.bdshare_popup_bottom a {
font-family: 'Microsoft Yahei';
}
.bdshare_popup_top {
display: none;
}
.bdshare_popup_bottom {
height: auto;
padding: 5px;
}
</style>
</div>
<a href="http://ittiger.cn/Android调用相机无法执行onActivityResult或data为null.html#comments" class="article-comment-link ds-thread-count" data-thread-key="http://ittiger.cn/Android调用相机无法执行onActivityResult或data为null.html">评论</a>
</footer>
</div>
<nav id="article-nav">
<a href="/Android基础之点击两次返回键退出程序.html" id="article-nav-newer" class="article-nav-link-wrap">
<strong class="article-nav-caption">上一篇</strong>
<div class="article-nav-title">
Android基础之点击两次返回键退出程序
</div>
</a>
<a href="/Android基础之解压zip中文乱码处理.html" id="article-nav-older" class="article-nav-link-wrap">
<strong class="article-nav-caption">下一篇</strong>
<div class="article-nav-title">Android基础之解压zip中文乱码处理</div>
</a>
</nav>
</article>
<section id="comments">
<div class="ds-thread" data-thread-key="Android调用相机无法执行onActivityResult或data为null.html" data-title="Android调用相机无法执行onActivityResult或data为null" data-url="http://ittiger.cn/Android调用相机无法执行onActivityResult或data为null.html"></div>
<style>
#ds-thread #ds-reset .ds-textarea-wrapper {
background: none;
}
#ds-reset .ds-avatar img {
box-shadow: none;
}
#ds-reset .ds-gradient-bg {
background: #f7f7f7;
}
#ds-thread #ds-reset li.ds-tab a {
border-radius: 3px;
}
#ds-thread #ds-reset .ds-post-button {
color: white;
border: none;
box-shadow: none;
background: #d32;
text-shadow: none;
font-weight: normal;
font-family: 'Microsoft Yahei';
}
#ds-thread #ds-reset .ds-post-button:hover {
color: white;
background: #DE594C;
}
#ds-thread #ds-reset .ds-post-button:active {
background: #d32;
}
#ds-smilies-tooltip ul.ds-smilies-tabs li a.ds-current {
color: white;
background: #d32;
box-shadow: none;
text-shadow: none;
font-weight: normal;
}
</style>
</section>
</section>
<aside id="sidebar">
<div class="widget-wrap">
<h3 class="widget-title">最新文章</h3>
<div class="widget">
<ul id="recent-post" class="no-thumbnail">
<li>
<div class="item-inner">
<p class="item-category"><a class="article-category-link" href="/categories/小程序/">小程序</a></p>
<p class="item-title"><a href="/weixin-xcx-data-binding-and-params-transfer.html" class="title">微信小程序之页面数据绑定及页面跳转传参</a></p>
<p class="item-date"><time datetime="2017-07-17T09:50:02.000Z" itemprop="datePublished">2017-07-17</time></p>
</div>
</li>
<li>
<div class="item-inner">
<p class="item-category"><a class="article-category-link" href="/categories/小程序/">小程序</a></p>
<p class="item-title"><a href="/weixin-xcx-tabbar-switch.html" class="title">微信小程序之Tab切换</a></p>
<p class="item-date"><time datetime="2017-07-17T09:44:58.000Z" itemprop="datePublished">2017-07-17</time></p>
</div>
</li>
<li>
<div class="item-inner">
<p class="item-category"><a class="article-category-link" href="/categories/小程序/">小程序</a></p>
<p class="item-title"><a href="/weixin-xcx-first-project.html" class="title">微信小程序之入门项目</a></p>
<p class="item-date"><time datetime="2017-07-17T09:40:39.000Z" itemprop="datePublished">2017-07-17</time></p>
</div>
</li>
<li>
<div class="item-inner">
<p class="item-category"><a class="article-category-link" href="/categories/Android/">Android</a></p>
<p class="item-title"><a href="/TextSwitcher-ViewSwitcher.html" class="title">TextSwitcher与ViewSwitcher学习笔记</a></p>
<p class="item-date"><time datetime="2017-07-12T09:36:51.000Z" itemprop="datePublished">2017-07-12</time></p>
</div>
</li>
<li>
<div class="item-inner">
<p class="item-category"><a class="article-category-link" href="/categories/Media-Apps/">Media Apps</a></p>
<p class="item-title"><a href="/MediaBrowserService.html" class="title">关于媒体浏览器服务(MediaBrowserService)</a></p>
<p class="item-date"><time datetime="2017-04-30T13:45:04.000Z" itemprop="datePublished">2017-04-30</time></p>
</div>
</li>
</ul>
</div>
</div>
<div class="widget-wrap">
<h3 class="widget-title">分类</h3>
<div class="widget">
<ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/Android/">Android</a><span class="category-list-count">34</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Blog/">Blog</a><span class="category-list-count">3</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Java/">Java</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/JavaScript/">JavaScript</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Linux/">Linux</a><span class="category-list-count">3</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Material-Design/">Material Design</a><span class="category-list-count">3</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Media-Apps/">Media Apps</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/小程序/">小程序</a><span class="category-list-count">3</span></li></ul>
</div>
</div>
<div class="widget-wrap">
<h3 class="widget-title">归档</h3>
<div class="widget">
<ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/07/">七月 2017</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/04/">四月 2017</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/03/">三月 2017</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/02/">二月 2017</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/12/">十二月 2016</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/11/">十一月 2016</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/10/">十月 2016</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/09/">九月 2016</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/08/">八月 2016</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/07/">七月 2016</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/06/">六月 2016</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/05/">五月 2016</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/01/">一月 2016</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/11/">十一月 2015</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/10/">十月 2015</a><span class="archive-list-count">10</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/09/">九月 2015</a><span class="archive-list-count">9</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/03/">三月 2015</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/12/">十二月 2014</a><span class="archive-list-count">1</span></li></ul>
</div>
</div>
<div class="widget-wrap">
<h3 class="widget-title">标签云</h3>
<div class="widget tagcloud">
<a href="/tags/9-png/" style="font-size: 12px;">9.png</a> <a href="/tags/Activity/" style="font-size: 10px;">Activity</a> <a href="/tags/Android/" style="font-size: 20px;">Android</a> <a href="/tags/AndroidStudio/" style="font-size: 10px;">AndroidStudio</a> <a href="/tags/Apache/" style="font-size: 10px;">Apache</a> <a href="/tags/Behavior/" style="font-size: 14px;">Behavior</a> <a href="/tags/Hexo/" style="font-size: 10px;">Hexo</a> <a href="/tags/IM/" style="font-size: 18px;">IM</a> <a href="/tags/IndexStickyView/" style="font-size: 10px;">IndexStickyView</a> <a href="/tags/JSONP/" style="font-size: 10px;">JSONP</a> <a href="/tags/Java/" style="font-size: 10px;">Java</a> <a href="/tags/JavaScript/" style="font-size: 10px;">JavaScript</a> <a href="/tags/Linux/" style="font-size: 18px;">Linux</a> <a href="/tags/Lucene/" style="font-size: 10px;">Lucene</a> <a href="/tags/Material-Design/" style="font-size: 14px;">Material Design</a> <a href="/tags/MediaBrowserService/" style="font-size: 10px;">MediaBrowserService</a> <a href="/tags/MediaControllerCompat/" style="font-size: 10px;">MediaControllerCompat</a> <a href="/tags/MySQL/" style="font-size: 10px;">MySQL</a> <a href="/tags/ORM/" style="font-size: 10px;">ORM</a> <a href="/tags/OkHttp/" style="font-size: 12px;">OkHttp</a> <a href="/tags/Openfire/" style="font-size: 18px;">Openfire</a> <a href="/tags/RecyclerView/" style="font-size: 16px;">RecyclerView</a> <a href="/tags/Retrofit/" style="font-size: 14px;">Retrofit</a> <a href="/tags/RxJava/" style="font-size: 10px;">RxJava</a> <a href="/tags/SQLite/" style="font-size: 10px;">SQLite</a> <a href="/tags/Shape/" style="font-size: 10px;">Shape</a> <a href="/tags/SpannableStringBuilder/" style="font-size: 10px;">SpannableStringBuilder</a> <a href="/tags/TableLayout/" style="font-size: 10px;">TableLayout</a> <a href="/tags/TextSwitcher/" style="font-size: 10px;">TextSwitcher</a> <a href="/tags/TextView/" style="font-size: 10px;">TextView</a> <a href="/tags/TigerDB/" style="font-size: 10px;">TigerDB</a> <a href="/tags/TigerOkHttp/" style="font-size: 10px;">TigerOkHttp</a> <a href="/tags/Tips/" style="font-size: 10px;">Tips</a> <a href="/tags/ViewSwitcher/" style="font-size: 10px;">ViewSwitcher</a> <a href="/tags/WordPress/" style="font-size: 18px;">WordPress</a> <a href="/tags/Zip解压/" style="font-size: 10px;">Zip解压</a> <a href="/tags/smack/" style="font-size: 18px;">smack</a> <a href="/tags/vsftpd/" style="font-size: 10px;">vsftpd</a> <a href="/tags/导航/" style="font-size: 10px;">导航</a> <a href="/tags/小程序/" style="font-size: 14px;">小程序</a> <a href="/tags/崩溃/" style="font-size: 10px;">崩溃</a> <a href="/tags/生命周期/" style="font-size: 10px;">生命周期</a> <a href="/tags/百度地图/" style="font-size: 10px;">百度地图</a> <a href="/tags/相机/" style="font-size: 12px;">相机</a> <a href="/tags/资源适配/" style="font-size: 10px;">资源适配</a> <a href="/tags/退出App/" style="font-size: 10px;">退出App</a> <a href="/tags/阿里云/" style="font-size: 18px;">阿里云</a>
</div>
</div>
<div class="widget-wrap widget-list">
<h3 class="widget-title">链接</h3>
<div class="widget">
<ul>
<li>
<a href="https://ashui.site/" rel="external nofollow">番羽土啬</a>
</li>
</ul>
</div>
</div>
<div id="toTop" class="fa fa-angle-up"></div>
</aside>
</div>
<footer id="footer">
<div class="outer">
<div id="footer-info" class="inner">
© 2017 老胡<br>
Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>. Theme by <a href="http://github.com/ppoffice">PPOffice</a>
</div>
</div>
</footer>
<script type="text/javascript">
var duoshuoQuery = {short_name:'ittiger'};
(function() {
var ds = document.createElement('script');
ds.type = 'text/javascript';ds.async = true;
ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
ds.charset = 'UTF-8';
(document.getElementsByTagName('head')[0]
|| document.getElementsByTagName('body')[0]).appendChild(ds);
})();
</script>
<script src="/libs/lightgallery/js/lightgallery.min.js"></script>
<script src="/libs/lightgallery/js/lg-thumbnail.min.js"></script>
<script src="/libs/lightgallery/js/lg-pager.min.js"></script>
<script src="/libs/lightgallery/js/lg-autoplay.min.js"></script>
<script src="/libs/lightgallery/js/lg-fullscreen.min.js"></script>
<script src="/libs/lightgallery/js/lg-zoom.min.js"></script>
<script src="/libs/lightgallery/js/lg-hash.min.js"></script>
<script src="/libs/lightgallery/js/lg-share.min.js"></script>
<script src="/libs/lightgallery/js/lg-video.min.js"></script>
<script src="/libs/justified-gallery/jquery.justifiedGallery.min.js"></script>
<!-- Custom Scripts -->
<script src="/js/main.js"></script>
</div>
</body>
</html>