In my existing android app, Im using MuPDF, which i ported with help of this doc. Now when i want to open pdf files inside activity i use : Uri uri = Uri.parse(path);
Intent intent = new Intent(this, MuPDFActivity.class);
intent.setAction(Intent.ACTION_VIEW);
intent.setData(uri);
startActivity(intent);
which fires a new activity, My problem is: (1) how can I start Fragment to view pdf? (2) Does MuPDF supports Fragment that I can call under my currant Android-Tab-View? (3) Is there a Way Converting this activity into fragment?
Currently i'm doing:
public class DummySectionFragment extends Fragment {
public DummySectionFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = null;
rootView = inflater.inflate(R.layout.activity_dummy_section_fragment, container, false);
Intent myIntent = new Intent(getActivity(), MuPDFActivity.class);
myIntent.setAction(Intent.ACTION_VIEW);
myIntent.setData(uri);
getActivity().startActivity(myIntent);
return rootView;
}
}
Which: opens a new activity on my current Tab View layout, which does not look great as it covers entire tab layout and user have to click BACK
button to view tab view.