安卓:调用从片段活动 [英] Android : Calling Activity from Fragment

查看:168
本文介绍了安卓:调用从片段活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是活动的内部片段。我使用MediaRecorder为录音。 我有两个部分的活动。 第1本身的活动,这将列出录制的文件。 在它的右侧AudioRecording活动被称为当一个人选择录制新文件。 当选择任何列出的文件我使用AudioPlayer,以播放录制的文件。 我在这里能够将活动转换成片段,但是当I $上停止p $ PSS它将终止应用程序。

I am using fragments inside an activity. I am using MediaRecorder to for audio recording. I have two part of an activity. 1st itself the Activity which will list the recorded file. On it's right side the AudioRecording Activity is called when one select to record for a new file. When the any of the listed file is selected i am using AudioPlayer as to play the recorded file. I am here able to convert the Activity into fragment but when i press on Stop it is terminating the application.

请任何人都可以回答。我audiorecorder工作正常,当我把它当作简单的活动。 就像如果我可以调用该分段或类似的东西,活动的任何解决方案? 请帮我,如果有人知道。

Please anyone can answer. My audiorecorder is working fine when i use it as simple activity. Any solution like if i can call that activity in that fragment or something like that.? Please help me if anyone knows.

推荐答案

使用GET活性然后做和往常一样获取父活动。

Get the parent activity using get activity then do as usual.

Intent myIntent = new Intent(getActivity(), BookmarkActivity.class);
                getActivity().startActivity(myIntent); 

这篇关于安卓:调用从片段活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆