I am working on application where I need to open inbuilt apps in a custom screen like in Popup window
but when I invoke the inbuilt app the screen size is full screen while I need customize screen size. The inbuilt app can be anything like browser or pdfreader.
Here is my code :-
String strurl = "/sdcard/download/28889.pdf";
File file = new File(strurl);
if (file.exists()) {
Uri path = Uri.fromFile(file);
// Log.e("path of the file",path.toString());
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
try {
startActivity(intent);
}
catch (ActivityNotFoundException e) {
Toast.makeText(getApplicationContext(),
"No Application Available to View PDF",
Toast.LENGTH_SHORT).show();
}
This opens up new window in my app but I need Popup kind of window where I need to show this pdfreader to get display.
By design, Android does not allow one app to run inside another (among other things, for obvious security reasons). So if that is what you want to do, you are out of luck.
BUT you can use a WebView (I let you consult the doc on this class) to display a webpage inside your app.
There are also some pdf libraries out there. A word of caution though, I worked on a pdf reader on Android 1 year ago and implementing a pdf reader was just not the best solution. Handling the pdf decoding on server side and serving a view of this image (or conversion to html) was the best solution.
This way you don’t use too much computing power to read the pdf (surprisingly you need some serious cpu to read a pdf).
Things may have changed since I made that development (I was really constrained by the time factor) though but I still don’t think that unless you explicitely need to display a pdf document and not just a document (for example a legitimate reason would be that you need to check the signature of the pdf on the Android device), you should not use the pdf format on a phone.