Reputation: 11
I am new to Android. I have developed a small app which launches pdf files from Asset when a button is pressed.
public class Finish_Center extends AppCompatActivity {
PDFView Sample;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_Sample);
Sample = (PDFView) findViewById(R.id.Sample);
Sample.fromAsset("Book1.pdf").load();
This loads the pdf. But it does not enable me to search the content. There is no search icon in the launched pdf. Hence I am not able to use "find" option of pdf. As the pdf attached are big and used as reference I want to search content.
I tried keeping key pad visibility (To try (pressing Cntrl+F) but since there is no text view, Keypad is not visble.
Can someone suggest a method so that I will be able to search content in the pdf that is launched.
Regards,
Ashay
Upvotes: 1
Views: 79
Reputation: 4178
Use the method indicated below, so that each user may open it using their device's default app (which will probably provide a search feature).
File book = new File("path/for/your/Book1.pdf");
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(book), "application/pdf");
startActivity(intent);
Upvotes: 3