我正在使用Intent.Action.Send发送数据,如(图像,文本)。我想要结果数据发送与否但onActivityResult不起作用。请检查代码。帮助我。 得到错误: -
01-25 19:12:49.160 140-19149/? E/DrmMtkUtil/DrmUtil: checkDcf: not dcf type, dcf version value [80]
01-25 19:12:49.160 140-19149/? E/DrmMtkUtil/DrmUtil: checkDcf: not dcf type, dcf version value [80]
01-25 19:12:49.161 140-19149/? E/DrmMtkUtil/DrmUtil: checkDcf: not dcf type, dcf version value [80]
01-25 19:12:49.164 139-139/? E/DrmMtkUtil/DrmUtil: parseDcf: not dcf type, dcf version value [80]
01-25 19:12:49.164 139-139/? E/DrmMtkPlugIn: onOpenDecryptSession() : failed to parse dcf file.
01-25 19:12:49.192 140-19149/? E/AsfParser: unknown object: 20000000-7466-7079-4d34412000000000, 541144141 bytes
01-25 19:12:49.192 140-19149/? E/AsfParser: error parsing header: -6
01-25 19:12:49.198 140-27751/? E/MtkOmxAudioDecBase: MtkOmxAudioDecBase:SetParameter unsupported nParamIndex(0x7F00001E)
01-25 19:12:49.200 140-27751/? E/OMXCodec: @@ [OUT] def.nBufferSize = 24576
01-25 19:12:49.200 140-27751/? E/OMXCodec: @@ [OUT] totalSize = 221696
01-25 19:12:49.201 27103-27103/? E/MediaPlayer: Should have subtitle controller already set
01-25 19:12:49.203 140-16861/? E/OMXCodec: [OMX.MTK.AUDIO.DECODER.AAC] +waitForBufferFilled_l: 4/0
01-25 19:12:49.204 140-27754/? E/OMXCodec: @@ [OUT] def.nBufferSize = 24576
01-25 19:12:49.204 140-27754/? E/OMXCodec: @@ [OUT] totalSize = 221696
01-25 19:12:49.205 140-16861/? E/OMXCodec: [OMX.MTK.AUDIO.DECODER.AAC] -waitForBufferFilled_l
01-25 19:12:49.205 140-16861/? E/OMXCodec: [OMX.MTK.AUDIO.DECODER.AAC] +waitForBufferFilled_l: 6/0
01-25 19:12:49.206 140-16861/? E/OMXCodec: [OMX.MTK.AUDIO.DECODER.AAC] -waitForBufferFilled_l
01-25 19:12:49.208 140-27755/? E/OMXCodec: [OMX.MTK.AUDIO.DECODER.AAC] No more output data in fillOutputBuffer, mFilledBuffers size=3
01-25 19:12:49.208 140-27755/? E/OMXCodec: [OMX.MTK.AUDIO.DECODER.AAC] No more output data in fillOutputBuffer, mFilledBuffers size=2
01-25 19:12:49.208 140-27755/? E/OMXCodec: [OMX.MTK.AUDIO.DECODER.AAC] No more output data in fillOutputBuffer, mFilledBuffers size=1
01-25 19:12:49.208 140-27755/? E/OMXCodec: [OMX.MTK.AUDIO.DECODER.AAC] No more output data in fillOutputBuffer, mFilledBuffers size=0
01-25 19:12:49.208 140-27755/? E/OMXCodec: [OMX.MTK.AUDIO.DECODER.AAC] read() final return
适配器类: -
holder.shareRL.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String des = eventlist.get(position).get("Description");
String location = eventlist.get(position).get("location");
String time = eventlist.get(position).get("Event_date_time");
String title = eventlist.get(position).get("Event_title");
intent_str = "Event Show " + "\n " + title + " \n" + time + "\n" + location + "\n" + des;
TredingFragment.Share_intent((Activity) mContext);
}
TredingFragment类: -
public static void Share_intent(Activity activity) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, Eventlist_adapter.intent_str);
//activity.setResult(Activity.RESULT_OK,intent);
activity.startActivityForResult(Intent.createChooser(intent, "Share and earn a extra Priviledge"), 111);
}
onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
// super.onActivityResult(requestCode, resultCode, data);
Log.e("code", REQUEST_FOR_ACTIVITY_CODE + "");
Log.e("result", requestCode + "");
Log.e("result", resultCode + "");
if (requestCode == 111) {
if (resultCode == Activity.RESULT_OK) {
Log.e("result", "okkkk" + "");
// Toast.makeText(this, "Ok DUDE", Toast.LENGTH_LONG).show();
} else if (resultCode == Activity.RESULT_CANCELED) {
// Toast.makeText(this, "Oversmart Eh!!", Toast.LENGTH_LONG).show();
Log.e("result", "okkk" + "");
}
}
}
答案 0 :(得分:1)
ACTION_SEND
未返回结果(the documentation中的“输出:无”),因此将其与startActivityForResult()
一起使用毫无意义。
答案 1 :(得分:0)
通过ACTION_SEND
意图打开的应用程序不会自行关闭,除非用户按下Back
按钮。因此,没有使用等待Intent
的结果。