Learning Notes on OKHttp3, an Android Network Framework
2017-08-16 170 views Android Android

This is a complete project for fetching and displaying network images using HTTP GET and POST requests in Android, as well as saving these images to the SD card. The project involves basic network communication, thread handling, and UI updates via Handler, among other key knowledge points. Here are the detailed steps of the project: 1. **Permission Setup** - Add the necessary permissions in the `AndroidManifest.xml` file: ```xml <uses-permission android:

Read More
Android Booting and Startup
2017-08-16 164 views Android Android

The article introduces the steps and code implementation for achieving the boot - start function using broadcast receivers in Android. First, create a BroadcastReceiver class through Android Studio. Then, register this BroadcastReceiver in the <receiver> element in the manifest file, and add the attributes android:enabled="true" and android:exported="true" to ensure its availability. At the same time, in the <intent - filt

Read More
Implementation of an Android Drawing Board
2017-08-16 179 views Android Android

This article introduces how to implement a simple drawing board function. The layout includes three buttons and an image for operation and display. The key part in the Java code is the touch event handling of ImageView. When pressed, the starting point coordinates are recorded; when sliding, a straight line is drawn on the canvas and the image is updated; when released, the ending point coordinates are recorded. In addition, the program also provides color and thickness adjustment functions (implemented through buttons) and a function to save the image. When the user clicks the "Save Image" button, the current Bitmap is saved as a PNG file, and a success prompt message is displayed. Overall,

Read More
Playing Music with Android Service
2017-08-16 199 views Android Android

This article introduces the method of implementing a music player using a Service. First, a custom Service named MusicService is created, and related operations of MediaPlayer are implemented within it. Then, in MainActivity, the Service is bound to control music playback, including functions such as play and pause, and the progress bar can be updated in real-time. In addition, the article also mentions how to load audio files from the network and adds necessary permission declarations. Throughout the implementation process, time-consuming operations such as preparing audio resources are moved to the background.

Read More
Implementing WeChat-Style Bottom Navigation with Fragments in Android
2017-08-16 230 views Android Android

You have successfully implemented a simple bottom navigation bar, where each tab corresponds to a Fragment. This is a common feature in Android applications. Below are some supplementary explanations and suggestions for your code and workflow: ### Code Structure Summary - **MainActivity**: Responsible for loading and switching between different Fragments. - **Four Fragments** (WeiXinFragment, ContactFragment, FindFragment, M

Read More
Displaying Network Images Directly on ImageView in Android
2017-08-16 229 views Android Android

This code demonstrates how to implement image network downloading and local caching functionality in an Android application. The following is a detailed analysis of the code: ### 1. **Network Image Download** #### a. Obtain Image URL ```java String url = "https://pic.cnblogs.com/avatar/1142647/20170416093225.png"; ``` #### b. Create `BitmapWorker` Class

Read More
Reading SMS and Contacts on Android
2017-08-16 227 views Android Android

This tutorial explains in detail how to read SMS and contact information in an Android application. To help you better understand and practice, I will organize and simplify these steps and provide some improvement suggestions. ### 1. Accessing SMS #### Steps: - Ensure the following permission is added in `AndroidManifest.xml`: ```xml <uses-permission android:name="android.permission.READ_SMS"/> ```

Read More
SQL Format Notes
2017-07-06 220 views 后端 SQL database

This content mainly introduces the basic SQL statements for creating, modifying, and deleting tables, as well as data querying, inserting, updating, and deleting. First, when creating a table, you need to define the data types and constraints of columns; for modifying a table, you can add or delete columns/constraints, or change the properties of columns; for deletion, you can directly use the `drop table` command and optionally cascade delete related dependencies. Query statements use the `select` keyword to retrieve data from specified tables and support grouping and sorting. In addition, various conditional expressions are also introduced, such as `like`, `insert into...value` (note: the original text may have an incomplete `insert into...value` statement, which has been retained as is).

Read More
Solving Chinese Garbled Characters in MySQL under XAMPP
2017-05-27 227 views 后端 XAMPP

This article introduces how to set up UTF-8 encoding in MySQL integrated with XAMPP. First, open the configuration file my.ini in the control panel and add four lines of code: default_character_set = utf8, character-set-server = utf8, collation-server = utf8_general_ci, and default_character_set = utf8. Then restart the MySQL service and ensure that when creating the database (the original content is incomplete, the translation ends here based on the provided text).

Read More
Developing Java Web Projects with IntelliJ IDEA
2017-05-21 210 views 后端 JavaWeb

This article introduces the basic steps to develop Java Web applications using IntelliJ IDEA Ultimate. First, download and install the software from the official website, choosing the trial version during installation. When creating a new Java Web project, configure the Tomcat path in the Application Server and add a JSP file. Finally, click the run button to automatically open the homepage in the browser; directly click the browse icon in the upper right corner of IDEA to preview the newly created hello.jsp page. The entire process simplifies the complex

Read More
Installing Ubuntu Linux Subsystem on Windows 10
2017-05-14 343 views 其他 Ubuntu Windows Linux subsystem

This article introduces two methods to install the Ubuntu subsystem on Windows 10. The first method is to search and obtain it through the Microsoft Store, which requires opening the Settings and enabling Developer Mode first. The second method is to use the command `lxrun /install` in PowerShell for installation. The detailed process includes downloading the installation package, setting up the username and password, and other steps. After installation, you can launch the Ubuntu subsystem by entering "bash" in PowerShell and check the root directory to confirm the successful installation. If uninstallation is needed, you can use the PowerShell command... (Note: The original Chinese text was cut off at "uninstall can be done in Powe", so the translation assumes the continuation with relevant commands, but only the provided content is translated as per the user's input.) (根据用户提供的原文结尾截断情况,上述翻译中保留了原文最后不完整的部分“can be done in Powe”,完整翻译需基于完整原文。若用户实际原文末尾还有内容,需补充完整后再次翻译。)

Read More
Log.d() Not Outputting in Android Debugging
2017-05-13 213 views Android Android

The article discusses the differences in log output between real devices and emulators during Android application debugging. The author found that when debugging on a real device, the logs from Log.d() were not printed, and only error logs could be seen, whereas in the emulator, all levels of logs were displayed normally. The reason is that some mobile phone manufacturers restrict the output of low-level logs. Therefore, the author proposes a solution: creating a `LogUtil` utility class to wrap the Android Log methods. This class decides whether to print corresponding log entries by judging whether it is a debug environment and the current log level, allowing flexible control over... (Note: The original text seems to be cut off at the end, so the translation ends here as per the provided content.)

Read More
Receiving and Sending Cookies in Android
2017-05-13 238 views Android Android Cookie

This article author shares the difficulties encountered when implementing automatic login on the web using Okhttp3 and provides solutions. By default, Android does not save cookies, so it is necessary to manually save the obtained cookies into SharedPreferences; at the same time, read the cookies from SharedPreferences and add them to the request headers in each request. The specific steps include: defining constants ISLOGINED and COOKIE; writing the saveCookiePreference() method to save

Read More
Setting up a Java Web Server on Ubuntu Server
2017-04-16 261 views 后端 Ubuntu server JavaWeb server

This article details the steps to install and configure Tomcat, PHPMyAdmin, and resolve MySQL Chinese garbled characters issues on an Ubuntu server. Below is a summary of the content along with some supplementary information: 1. **Installing and Setting Up Apache2** - Changed the Apache2 service port to 8022 to avoid conflicts with other web services. - Started Apache. 2. **Installing PHPMyAdmin and Associating with Apache2** - Configured Apache to support p

Read More
Uploading a Project to Gitee
2017-04-15 171 views 其他 Gitee Free

This article introduces the method of uploading a project to Gitee, with reasons including: high brand awareness suitable for domestic users; all projects being free; and simple operation easy for beginners to start with. The specific steps are: first, register and log in to the account, create a project on the official website, and fill in relevant information; then, select an appropriate IDE locally to create project files; clone the project to the local machine via Git Bash; add the files to version control, commit and synchronize them. Finally, the uploaded project can be viewed on Gitee. The entire process is straightforward and clear, suitable for beginners to operate.

Read More