اذهب الي المحتوي
أوفيسنا
بحث مخصص من جوجل فى أوفيسنا
Custom Search
IsIs

code java

Recommended Posts

السلام عليكم ورحمة الله وبركاته

تكرماً من يشرح هذا الكود اريد تعليقات عليه

 

package com.saleem.pdffile;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

import com.github.barteksc.pdfviewer.PDFView;

public class MainActivity extends AppCompatActivity {
    ListView pdfListView;
    public void Button1 (View v){
        for (int i = 0; i < 12 ; i++){
            int x = i + 2;
            Log.d("Head", "x="+x);
        }
    }
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        pdfListView = (ListView) findViewById(R.id.myPDFList);
        String[] pdfFiles = {"A-Novel-Image-Retrieval-fulltext", "Consumer_Buying_Behavior", "E-Marketing", "ERP", "javed2016",
                "Knowledge Management", "Managing digital", "Marketing_Information_System", "Marketing_Issues", "MoviesList_From_Start_to_Finish",
                "Operations On Data", "OperSys_LabManual9", "Products_Services_and_Brands", "Supply chain and demand", "Tabbed_Application_From_Start_to_Finish"};

        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, 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<?> adapterView, View view, int i, long id) {

                String item = pdfListView.getItemAtPosition(i).toString();
                Intent start = new Intent(getApplicationContext(), PDFOpener.class);
                start.putExtra("pdfFileName", item);
                startActivity(start);
            }
        });


    }
}

 

 

package com.saleem.pdffile;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import com.github.barteksc.pdfviewer.PDFView;

public class PDFOpener extends AppCompatActivity {
     PDFView myPDFViewer;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_p_d_f_opener);
        myPDFViewer = (PDFView) findViewById(R.id.pdfViewer);
        String getItem = getIntent().getStringExtra("pdfFileName");

       if (getItem.equals("A-Novel-Image-Retrieval-fulltext")){
           myPDFViewer.fromAsset("A-Novel-Image-Retrieval-fulltext.PDF").load();
       }
        if (getItem.equals("Consumer_Buying_Behavior")){
            myPDFViewer.fromAsset("Consumer_Buying_Behavior.PDF").load();
        }
        if (getItem.equals("E-Marketing")){
            myPDFViewer.fromAsset("E-Marketing.PDF").load();
        }
        if (getItem.equals("ERP")){
            myPDFViewer.fromAsset("ERP.PDF").load();
        }
        if (getItem.equals("javed2016")){
            myPDFViewer.fromAsset("javed2016.PDF").load();
        }
        if (getItem.equals("Knowledge Management")){
            myPDFViewer.fromAsset("Knowledge Management.PDF").load();
        }
        if (getItem.equals("Managing digital")){
            myPDFViewer.fromAsset("Managing digital.PDF").load();
        }
        if (getItem.equals("Marketing_Information_System")){
            myPDFViewer.fromAsset("Marketing_Information_System.PDF").load();
        }
        if (getItem.equals("Marketing_Issues")){
            myPDFViewer.fromAsset("Marketing_Issues.PDF").load();
        }
        if (getItem.equals("MoviesList_From_Start_to_Finish")){
            myPDFViewer.fromAsset("MoviesList_From_Start_to_Finish.PDF").load();
        }
        if (getItem.equals("Operations On Data")){
            myPDFViewer.fromAsset("Operations On Data.PDF").load();
        }
        if (getItem.equals("OperSys_LabManual9")){
            myPDFViewer.fromAsset("OperSys_LabManual9.PDF").load();
        }
        if (getItem.equals("Products_Services_and_Brands")){
            myPDFViewer.fromAsset("Products_Services_and_Brands.PDF").load();
        }
        if (getItem.equals("Supply chain and demand")){
            myPDFViewer.fromAsset("Supply chain and demand.PDF").load();
        }
        if (getItem.equals("Tabbed_Application_From_Start_to_Finish")){
            myPDFViewer.fromAsset("Tabbed_Application_From_Start_to_Finish.PDF").load();
        }
    }
}

 

شارك هذه المشاركه


رابط المشاركه
شارك

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • المتواجدين الان   0 اعضاء متواجدين الان

    لايوجد اعضاء مسجلون يتصفحون هذه الصفحه

×
×
  • اضف...