Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
186 views
in Technique[技术] by (71.8m points)

java - Creating android form fields dynamically based on database entries

I am creating an inventory application in Android using Java. The application logic is as follows:

  1. Admin creates product list for which daily inventory needs to be taken.
  2. App users open up a form that would present to them list of products as per step 1) and EditText field next to each option to enter and submit data in the database.

I am not sure how to do this. Can anyone kindly nudge me in the right direction?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I am not sure that i got your question correct, but here are my suggesstions: Point 2 is the most simple.

You can use recycler view where will be complete item layout containing the whole information about product and edit text with submit button. You can also easily pass the callback function which saves data to DB through the constructor of the adapter, or setter function.

About point 1: It is a bit unclear for me. You mean the ecosystem with different account types, client applciations and server? If it is an ecosystem: you can go with two ways.

  1. Moderator application which can manage all your data and send it to a server throug post request. Server manages to use some push-service to notify client about changes, or client gets updates when he opens an app through get request.

In this case you need 2 applications and a server with own database

  1. Moderator and client perform log-in through one application, where is rights management. Depending on account type - you display different layouts + same server behavior.

In this case you need 1 client app with set of 2 different flows + server with own database.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

63 comments

56.7k users

...