'Zhuan' Python Intermediate Tutorial 4 — Software Interface

The original poster: , cool A Views: 339 Replies: 1 Posted in: 2012-04-18 17:33:58
Python Intermediate Tutorial 4 — Software Interface

I originally wanted to talk about menus first, because my own software interface skills aren't quite good yet, but considering that it would feel a bit odd to have a menu without a software interface, I decided to talk about the software interface first.

The Python software interface for Android is written in HTML (HyperText Markup Language).

[Note: This is the only method I know so far; I'm not sure if there are other ways.]

Our SL4A software comes with its own HTML editing tool. Let's open it together now.

Menu — Add — HTML and Javascript

Now, in the input box above, enter a name, for example 'html'. Between the and tags below, input:
Software Interface

As shown in Figure 1.

Now let's run it, and the result is shown in Figure 2.

As for HTML usage, I won't go into much detail. If you want to learn it, just look it up on Baidu! I won't embarrass myself here; I've only studied HTML for two days. Hehe~~~~

Alright, back to the main topic. Before explaining the next part, let's talk about webViewShow(). This is used to open web pages. It can open both external and internal web pages. What is an external web page? Simply put, it requires internet access. And internal? It doesn't require internet, just like the 'html.html' we created earlier. The parentheses are used to fill in the web page's address.

Now let's look at the code:
droid.webViewShow('/sdcard/sl4a/scripts/html.html')

After running it, the result is the same as in Figure 2. Isn't that simple? I won't elaborate further here. The webpage we just wrote is in the directory 'sdcard/sl4a/scripts', you can check it out yourself. The programs we write are also in that directory.

That's it for this section. If anything is unclear, you can post questions.

The third and fourth resources are the tutorial's source code for this section. Change the first one to html, and the second to py.

[The End]

Replying is a virtue!
× Preview
reply 🤍 0 📤 share collect
Bumping the original poster..
— All replies loaded —

Leave a Reply