0

I'm new for android coding, I have made a pdf list view but i cant see anything on my phone on android studio the list view is showing but when i try to see on my phone it shows a empty page

public class Gallery1 extends AppCompatActivity {

ListView pdfListView;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_gallery1);
    pdfListView = (ListView) findViewById(R.id.myPDFList);

    String[] pdfFiles = {"name one", "name two", "name three"};

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,android.R.id.text1, pdfFiles){


        @NonNull
        @Override
        public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {

            View view = super.getView(position, convertView, parent);
            TextView myText = (TextView) view.findViewById(android.R.id.text1);

            return view;
        }
    };

    pdfListView.setAdapter(adapter);

    pdfListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            String item = pdfListView.getItemAtPosition(position).toString();

            Intent start = new Intent(getApplicationContext(),PDFOpener.class);
            start.putExtra("pdfFileName",item);
            startActivity(start);

        }
    });

}

}

Siarhei
  • 2,358
  • 3
  • 27
  • 63
  • Does this answer your question? [Send a PDF file as Mail or offer app to directly view the file](https://stackoverflow.com/questions/25673238/send-a-pdf-file-as-mail-or-offer-app-to-directly-view-the-file) – Siarhei Apr 03 '20 at 14:41
  • aaah sorry wrong title , please ignore the title ""when i click on the share button on my newly built app i get a message “no apps can perform this action”" – Hareendra Dhanushka Apr 03 '20 at 14:41
  • you haven't set any text to your textView https://stackoverflow.com/a/45690724/5599807 – Siarhei Apr 03 '20 at 14:49
  • also i propose to check https://stackoverflow.com/questions/26728651/recyclerview-vs-listview – Siarhei Apr 03 '20 at 14:52

0 Answers0