Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.File;

import android.os.Environment;

public class Main {
    public static String DOWNLOADPATH = Environment.getExternalStorageDirectory().getAbsolutePath()
            + "/.java2s/java2sMarket/cache/apk/";

    public static boolean checkApkIsExist(String apkSaveName) {
        boolean isExist = false;
        File directory = new File(DOWNLOADPATH);
        if (directory.exists()) {
            File[] files = directory.listFiles();
            for (int i = 0; i < files.length; i++) {
                String fileName = files[i].getName();
                if (fileName.endsWith(".apk")) {
                    fileName = fileName.substring(0, fileName.length() - 4);
                    if (fileName.equals(apkSaveName)) {
                        isExist = true;
                        break;
                    }
                }
            }
        }
        return isExist;

    }
}