Android personal finance tool 4: add bill page

This paper considers sorting out the bill interface to realize the functions shown in the figure below. It should not be difficult before doing it, but in practice, it is found that arranging the interface layout is even more complex than writing program code. Online search found that little information about this layout can be used. Listview is the most used in Google demo, but the interface of this example seems to be more complex.

How to use spinner and cursor together has become the difficulty in completing this example. It should have been very simple, but it depressed me.

First, post the final effect picture:

Interface XML:

XML / HTML code

Let's look at the usage of spinner and cursor.

It is mainly a simplecursoradapter.

The code is as follows:

Java code

I've been here for two days. In fact, the writing method has always been correct, but every time I report an unknown line_ ID。 I also know this error is to use simplecursoradapter. The cursor of this method must include a_ ID field, but there must be some in my table. After I tried it countless times, I found that it is case sensitive. I pour it!

In fact, the statement I created the table is:

Java code

In the function getuserid, cursor is defined as:

Java code

There is no problem if you test this cursor alone.

It's no problem, that is, it's case insensitive here. However, if you use this cursor to bind to the simplecursoradapter, it must be consistent with the table creation statement, or an error will occur. I'm depressed here.

After the above interface layout and the spinner are completed, there is nothing new to improve the code and interface functions.

After the user selects the account, fills in the fee, selects the time and account type, it will be saved into the database bills table.

The latest code frm is attached_ Addbills. java:

Java code

The latest billdbhelper java :

Java code

Series of articles:

Android personal financial tool 6: display bill details

Android personal financial tool 5: display on bill details

Android personal finance tool 4: add bill page

Android personal finance tool 3: add to the bill page

Android personal finance tool 2: use SQLite to initialize data at startup

Android personal finance tool I: Project Overview and implementation of startup interface

The above is about the development of the details page of Android financial tools. We will continue to supplement other functions. Thank you for your support to this site!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>