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.
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.
Your fragment should have a parent
Best way of calling Activity from Fragment class is that make interface in Fragment and add
onItemClick()
method in that interface. Now implement it to your first activity and call second activity from there.In Fragment Class
Get the parent activity using get activity then do as usual.
Here is another alternative method. This worked for me.
To call another
activity
fromfragment
use this: