Waheed Abbas
Waheed Abbas

Reputation: 185

Load PPT File using Third Party Android Library

ScreenShot of the app after lauchingI have imported this library https://github.com/itsrts/pptviewer-android in my app by adding the .jar file in the libs folder.I want to load ppt files into my app.Unfortunately, the app keeps showing the loading spinner after launching.

MainActivity.java

package com.example.myapplication;

import android.app.Activity;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.itsrts.pptviewer.PPTViewer;


public class MainActivity extends Activity {

PPTViewer pptViewer;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    pptViewer = (PPTViewer) findViewById(R.id.pptviewer);
    String path = Environment.getExternalStorageDirectory().getPath()
            + "/Download/check.ppt";
    pptViewer.setNext_img(R.drawable.next).setPrev_img(R.drawable.prev)
            .setSettings_img(R.drawable.settings)
            .setZoomin_img(R.drawable.zoomin)
            .setZoomout_img(R.drawable.zoomout);
    pptViewer.loadPPT(this, path);

}
}

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.myapplication.MainActivity">

<com.itsrts.pptviewer.PPTViewer
    android:id="@+id/pptviewer"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
 </android.support.constraint.ConstraintLayout>

Upvotes: 1

Views: 2909

Answers (1)

siddhesh
siddhesh

Reputation: 563

PPT viewer code is running but it only has fullscreen issue. The reason why it is showing running is due to the ppt path you are providing is incorrect . If path provided is incorrect it keeps on loading. Try checking if path provided is correct

File file = new File("Environment.getExternalStorageDirectory().getPath()
        + "/Download/check.ppt"");
if(file.exists()){
        Toast.makeText(getApplicationContext(),"File Present",Toast.LENGTH_LONG).show();
    }else{
        Toast.makeText(getApplicationContext(),"File Not Present",Toast.LENGTH_LONG).show();
    }

if file not present or path is wrong it will show toast notification

Upvotes: 1

Related Questions