Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.Context;

import java.util.ArrayList;
import java.util.List;

public class Main {
    public static final String DATABASE_START = "BLANK ";
    public static final String DATABASE_TYPE = ".db";

    public static List<String> getDatabaseList(Context context) {
        String[] strDatabaseList = context.databaseList();

        List<String> list = new ArrayList<>();
        if (strDatabaseList != null) {
            for (String name : strDatabaseList) {
                if (name.startsWith(DATABASE_START) && name.endsWith(DATABASE_TYPE)) {
                    list.add(name.substring(0, name.length() - DATABASE_TYPE.length()));
                }
            }
        }

        return list;
    }
}