简体   繁体   English

在Android Studio开发中实现外部Java class

[英]Implementing external Java class in Android Studio development

I'm working on a very simple android application that will let me search for a link from a given database.我正在开发一个非常简单的 android 应用程序,它可以让我从给定数据库中搜索链接。 I managed to create the application without any trouble using Android Studio.我设法使用 Android Studio 毫无问题地创建了应用程序。 I have a button that is designed to open a search bar and search for the item in the database (searches for Key)我有一个按钮,旨在打开搜索栏并搜索数据库中的项目(搜索键)

I created a basic web scraping program (using Java) to gather my data and place it in a dictionary in an IntelliJ project.我创建了一个基本的 web 抓取程序(使用 Java)来收集我的数据并将其放在 IntelliJ 项目的字典中。

My question is: How do I connect accessing the database (Java/IntelliJ dictionary) to the button in my android app(Android-Studio)?我的问题是:如何将访问数据库(Java/IntelliJ 字典)连接到我的 android 应用程序(Android-Studio)中的按钮?

The IntelliJ dictionary has 2 functions, one to get the data, and one to search for it. IntelliJ 字典有两个功能,一个是获取数据,一个是搜索它。 My Android studio code has one button as follows:我的Android studio代码有一个按钮如下:


final Button ManualSearch = (Button) findViewById(R.id.DropDown);
        Scanner.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick (View v){
                // Access Database
                // call search method ()
                // search method will return data from database



            }
        });

You can't access any directory on the computer from a mobile application.您无法从移动应用程序访问计算机上的任何目录。 Why you even store the data into a dictionary of the IDE, is there any purpose to it??为什么你甚至将数据存储到 IDE 的字典中,有什么目的吗? That's alike shooting your own feet, but dearly.这就像射击自己的脚,但代价高昂。 Instead just save to SQL, JSON or XML in the res/raw directory and then install to Android SQLite from there. Instead just save to SQL, JSON or XML in the res/raw directory and then install to Android SQLite from there. Once I've even wrote a PHP script, which converts MySQL database to Android resource XML files... directly importing to SQLite on a computer would also be an option, then one can simply copy that database. Once I've even wrote a PHP script, which converts MySQL database to Android resource XML files... directly importing to SQLite on a computer would also be an option, then one can simply copy that database.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android 工作室 - kotlin class 在 java 文件中实施时未找到 - 错误“找不到符号类” - Android studio - kotlin class not found when implementing in java file - error "cannot find symbol class" How to modifiy a java class in a library used in android studio,kotlin android development - How to modifiy a java class in a library used in android studio,kotlin android development Android Studio Location API实现类签名 - Android Studio Location API implementing class signature 在Android Studio中实现Runnable类时出现NoClassDefFoundError - NoClassDefFoundError on implementing Runnable class in android studio Android Studio,Core Java中的离子应用程序开发 - Ionic app development in Android Studio, Core Java 在Android应用程序开发中调用Java类时出错 - Error in calling of java class in android app development 实施和使用SoundTouch类(Java Android) - Implementing and using SoundTouch class (Java Android) Android应用程序开发扩展了Java类 - Android app development extending a java class Android Studio从外部模块继承类 - Android studio inherit class from external module 致命异常:main java.lang.NoClassDefFoundError:外部library.jar.class Android Studio - FATAL EXCEPTION: main java.lang.NoClassDefFoundError: external library.jar.class Android studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM