After many years, I can still use android to do private work

Hello, I'm Mr. Jiao ya (o^^o)

Speaking of android, what a distant English word it is.

"The first line of code" I think all my friends who have studied android development should have read it. It can be said to be an entry masterpiece.

Looking at the masterpiece of Big Brother Guo Lin, at the moment, it's a little strange and a little familiar.

My mind seems to be pulled to 2015. I am close to graduation. I have no skills. I wear the stars and the moon and forget to eat and sleep

With the big guy's first line of code, everything is like yesterday. Suddenly, it has been many years.

It's worth talking about that I recently received a demo of app stock information query on an overseas platform with android technology that has been abandoned for many years.

Based on the principle that Chinese people don't cheat Chinese people, I played ten layers of script skills and persuaded overseas friends with one layer of android technology.

The requirements are as follows: make an app for stock query.

After that, you should learn some knowledge of software security on the basis of this app.

CS 5320 Homework .  	 Due on Canvas

Learning Outcomes
: Familiar with Android studio

Write a JAVA program in Android studio  and create a apk file to query information on stocks(current price,or something related). Android studio. For example, Type the stock symbol: TSLA to display the current price of Tesla.

The interface looks like this (Just a reference):

Type the TSLA, which is the stock symbol of Tesla, and get the display.

Note: You can use the existing stock acquisition API from the Internet resources.

I fixed my eyes and saw that this broken UI, my layer of android technology can still be a liver.

So I talked about the price decisively. The projects of overseas platforms naturally have an intermediary sister.

First of all, I need to ask about the price. The intermediary sister gave me 1000. I see it is so simple!!! It's so

I will please myself. So, I pulled on this basis, adding a few hundred dollars is not a big problem.

So he finally took it down at the price of 1500.

Although it is a very white project. I finally spent an hour dawdling through the first line of Guo Shen's code.

Here is a simple share. (although it's bad)

1, Stock app interface

Originally, there was no demand, but in line with the friendly attitude towards overseas friends, I decided to add one for free.

I dare to use such a beautiful welcome interface diagram. The code will naturally follow. A linear layout is enough.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=""


        android:text="Welcome to stock inquiry"

The stock query app interface of So easy is only so simple. Look, I beautified it.

CardView is used as the core information of stock information display.

2, Core code of stock app

According to the strong request of overseas friends, you should immediately display the core information of the stock on the CardView after clicking the inqury button.

That must be realized. In fact, here is mainly to find the stock information interface, because overseas friends want American stocks.

This is a free stock information access interface. You can see if you need it.

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    private TextView tvTicker;
    private TextView tvOpenPrice;
    private TextView tvPre;
    private TextView tvHigh;
    private TextView tvLowPrice;
    private EditText editText = null;
    protected void onCreate(Bundle savedInstanceState) {
        Button btn = findViewById(;
        editText = findViewById(;
        tvTicker = findViewById(;
        tvOpenPrice = findViewById(;
        tvPre = findViewById(;
        tvHigh = findViewById(;
        tvLowPrice = findViewById(;

    public void onClick(View v) {
        if (v.getId() =={
           String symbol = editText.getText().toString();

    private void sendRequest(final String symbol) {
        new Thread(new Runnable() {
            public void run() {
                    String url = "" + symbol+"/prev?unadjusted=true&apiKey=O0PC_KMaP8J7lLHpQ7czo16BktUF16y8";
                    OkHttpUtils.get().url(url).build().execute(new StringCallback() {
                        public void onError(Request request, Exception e) {
                            Toast.makeText(MainActivity.this,"Failed to obtain stock information !",Toast.LENGTH_SHORT).show();
                        public void onResponse(String response) {
                            try {
                            } catch (JSONException e) {

    private void parseData(String responseData) throws JSONException {

        JSONObject dataObject = new JSONObject(responseData);
        JSONArray results = dataObject.getJSONArray("results");
        for (int i = 0 ; i < results.length(); i++){
            JSONObject resultsData = results.getJSONObject(i);
            String ticker = resultsData.getString("T");
            String open = resultsData.getString("o");
            String Prec = resultsData.getString("c");
            String highest = resultsData.getString("h");
            String lowest = resultsData.getString("l");

    private void showReponse(final String ticker,final String open, final String Prec,final String highest,final String lowest) {

        runOnUiThread(new Runnable() {
            public void run() {


3, Summary

I personally think that when we take small projects, we should have the courage to deceive and pull, which should be beneficial to ourselves.

A simple demo project is as difficult as a flower. Don't be afraid to lose it.

If a small project takes all your rest time, I don't think it's worth it.

Keywords: Operation & Maintenance Android Docker server

Added by mac.php on Mon, 07 Mar 2022 01:38:56 +0200