Still confused - modules ?

aklisiewicz

Active Member
Licensed User
Longtime User
Ok, after some reading I'm still confused on the conceptual side of B4A.
I cannot find an information on how the modules are related to the whole project? Do I need more than one module? If yes - they when and why ?

Same thing with the activity. the DOCS explain what it is and how to manage it in general, but I still do not understand if I need a new screen do I need new activity, do I need new activity for every screen, if not Why?

As an example I created a ScreenLayout with few buttons to play a role of aMENU system. Now I know each button will call some routine with another screen etc. But I am completely lost on what to do next. Create new module for each procedure or shall I keep it all in one module. Shall each procedure be defined as separate activity?


Lack of this type documentation is a pain for new users. It would be really helpfull to spend some time on preparing some more info on those tipcs, as it will save time for Erel and alike, from answering those question over and over. If I have enough expertise I would certainly put some of my time to help, but I'm not there yet, so I do not know who should do it, but for a happy begining it is a must.

Thanks - Art
 
Last edited:

klaus

Expert
Licensed User
Longtime User
There is no straight forward answer !
You can do what ever you want, it's up to you to decide what you need and what you want.
You can do all in one Activity, and play with Panels for the different screens. It depends on the number of different screens you have. To have a good overloook on big projects it can be useful to split parts of the code.
Have a look at Different examples with two layouts. It shows you different possibilities to do the same stuff, two panels or two activities.
If you use several Activities you must take into account that when you start a new one, the previous one is paused (sent in background), look at Android Process and activities lifecycle. You a separate module for each activity.

Please stop complaining, complaining, complaining, complaining about the documentation, it's really getting boring. Have a more inquiring mind, the time you spend in complaining would more efficient in thinking and searching.
As already said in another post, begin with a concrete project, ask concrete questions, and you will get concrete answers. This has been proven many times on this forum.

Best regards.
 
Upvote 0

kickaha

Well-Known Member
Licensed User
Longtime User
The problem is that the answer is not clear cut. Lets take your example

As an example I created a ScreenLayout with few buttons to play a role of aMENU system. Now I know each button will call some routine with another screen etc. But I am completely lost on what to do next. Create new module for each procedure or shall I keep it all in one module. Shall each procedure be defined as separate activity?

OK, you have a menu system, now good programing practice would be to separate each menu choice into its own code module, and if they have different layouts then they would each be an activity.

BUT

What if one of those menu items was "About" and all it did was display "MyProg by aklisiewicz" for a few seconds. That would be easily dealt with by a pop-up panel or such in the activity module you are in.

You may also have a menu item that has no screen layout, but has a lot of code, this would be better suited to be put in a code module, but called from the main (menu) activity rather than have its own.

There are numerous examples that fall somewhere between these examples, with differing program complexity, and what each section is doing and how they interact.

It is then that the programmer needs to then decide how the whole app will flow (code wise), and how best to organize it. This (in my opinion) is an area where programmers really demonstrate how creative and clear thinking they are.

This cannot be readily taught, and certainly cannot be laid down in some guide on "how to", programmers need to practice, experiment and think for themselves and develop their own way of handling situations and set ups.

TO SUMMARISE:

Experience cannot be got from the pages of a book (unless the experience is reading of course).
 
Upvote 0

aklisiewicz

Active Member
Licensed User
Longtime User
How can I remove Module from the project ?

If I have MOdule1, Module2, Module3 - which of those is the main module which is started first, how can I change the Primary Module for the project, or there is not priority ?

Art
 
Upvote 0

JMB

Active Member
Licensed User
Longtime User
Hi Art

Here's a little bit more information about activities, variables and the life cycle at this post:

http://www.b4x.com/forum/basic4andr...937-process-variables-activity-lifecycle.html

I know the documentation situation is lacking at the moment, but the best thing is to set yourself some simple tasks and play around with the stuff, then post questions on the forum. There are people trying to sort out the documentation issues at the moment.

The forum is an excellent source of information. Answers are provided to clear questions very quickly by a whole range of people right through from beginners like myself all the way to experts like Erel, Klaus and Agraham to name but a few. There's no such thing as a stupid question, as long as it is presented politely! :)

In response to your question:

For Views, read Controls if you're from a Microsoft .NET or VB background. Android calls Controls Views. Weird. C'est la vie. But both systems are event driven.

You can respond to a button click in several ways. Say for example you've got a button which asks for address details for a user.

When you click that button you can do several things:

1) You can start a new activity which has its own local variables and local views and prompt the user for the information, storing it in global variables which your first or Main activity can read before destroying the second activity. This involves you in creating several different activities and using global variables to pass information between them.

2) You can have a hidden panel somewhere in your first activity which you can then move into the user's view, and make visible, and then respond to the request as appropriate. Panels are very useful, as they act as containers for other views and you can even load layouts into them. Doing things with panels means that you have just one activity, and you control what panels are visible from your program flow.

I am sure there are other ways, but that's a couple of ideas which I hope help a bit.

JMB
 
Upvote 0

aklisiewicz

Active Member
Licensed User
Longtime User
Thank you for your time.

Yes, I understand your point, and in general I agree. I'm coming from the environment where I developed mostly business type Apps (no games, multimedia, GPS, etc.) so that's why I'm a little lost. For What I need to do at the moment is to create 3 procedures, where each of them would not more than manipulating sQLite records, through the forms. I would like to have one button to display sort of HelpScreen. That's all at the moment, one I have this done will proceed to more advanced stuff.

I attached menu screenshoot. I would like to keep this Main screen as separate module, then from this one by clicking a button call other procedures.

Lets say I have a PRODUCTS as ListView in separate module ie. ModProducts. In that module I will have only two types of operation. 1) listing the products 2)selecting and showing product details

For the DISEASES button I will have similar situation, but there might be more screens (2-3) invoived to show records details

The THERAPY button will call similar procedure with an option to Add/Change/Delete record

The CONFIG button will call a FORM to edit single configuration record.

Since there will be quite a lot data, all screens should have 2-5 tabs

Art
 

Attachments

  • B4A_scn01.jpg
    B4A_scn01.jpg
    26.6 KB · Views: 213
Last edited:
Upvote 0

kickaha

Well-Known Member
Licensed User
Longtime User
How can I remove Module from the project ?

If I have MOdule1, Module2, Module3 - which of those is the main module which is started first, how can I change the Primary Module for the project, or there is not priority ?

Art

If you had done anything other than ask questions (like trying the software and loading some of the examples) you would see that:

The IDE comes complete with a menu entry called "remove module"
The main module that is started first is called (suprisingly) "main"
You cannot alter which module is seen as the main module

I agree with Klaus, your constant bleating is starting to grate. Try some programming.
 
Upvote 0

Merlot2309

Active Member
Licensed User
Longtime User
A little story

Hello Art,

Hopefully you do read this little story because I wrote it especially for you.

I would appreciate it if you post your comments and for sure your questions as well is separate topics. This has been asked before.

Take this as an example:
Klaus, your example is very nice, but this is not what I was looking for. I wanted an example which shows simple record manitpulation in sense of: Adding/Changing/Deleting through the FORM. yours does not use any forms to edit data. There is lots of things relatexd to forms...
I would like to see how to pass paramtere to the form, how ti PrimeFields, how to do multiple forms, etc... and most of all (like I mentioned in my other post) Parent/Childbeeing type screens...

Thanks - Art

This topic is about a guide that is beeing made for beginners.
Your post is messing up this topic and it doesn´t add anything to this topic either.
Other examples are available on request.

Do you ever check your spelling? Maybe that´s part of the reason that you hardly find any info yourself. I know that my english is not perfect, so you may beat me back on this one.

Klaus, Erel, Kickaha and others (I myself once - which got me a stupid response from you) have always done the utmost to help you and you simply don´t read it well, don´t try it, almost as if you don´t want to get it.


I can drive a car but I cannot build one, so I have to buy a car.
Never ever saw an add for a car which included driving lessons. :sign0163:

If you don´t have the time to do the learning process to develop, then hire someone or, at least, change your attitude.

Helen.
 
Upvote 0

kickaha

Well-Known Member
Licensed User
Longtime User
It often takes a woman to bring an air of clarity and sanity to things (sexist I know, but very often true).

Thanks Helen for a well observed post :sign0089:
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I'm sorry that things got to this level, but I stopped responding to aklisiewicz in the public forum.
Developers who want to develop with Basic4android must take the time and learn the main concepts.
Any question can be asked and it will be welcomed. However the developer asking the question should try to fully read the answer and continue from their. I don't feel that this is the case here.
This is a community of users who are trying to help each other.
 
Upvote 0

aklisiewicz

Active Member
Licensed User
Longtime User
If you had done anything other than ask questions (like trying the software and loading some of the examples) you would see that:

The main module that is started first is called (suprisingly) "main"
You cannot alter which module is seen as the main module

I agree with Klaus, your constant bleating is starting to grate. Try some programming.


Well, I noticed that option on the menu, but it was unavailable for the particular module. At that time I simply did not realize the MAIN module must remain its name and be a primary (As I thought I could rename it etc. and make another one primary). You see - the other tools I used used the modules as well, but I could go and assign any module as primary module, I could also stock as many procedures as I wanted within a module or have a single module for each procedure. Fro my perspective my questions are not so dumb as you seem to think, and even if they are obviously one has an option to not answer.

Your message helped - thanks.

PS>
As far as complaining, I would not say there is so much of a complains but rarther suggestions for future improvements. Questions which some might treat as dumb - might be dumb, but everyone was once at the starting point. I can agree to the fact (I mentioned before), I got a little spoiled with what I used in the past, so probably need some time to get use to new methods.

I hope none of the helpers got offended, as I never had any particular complain or criticism in mind on any of you, and I am greatfull for your help. B4A seem to be great product in its concept, but in my opinion is missing some finishing touches, and Erel's initiative to open a WIKI is one of the things very much expected. Klaus has done an excelent job with Manual, so I do see positive aspects. I have expressed my grattitude several times on several topics and some ofthe things look great. Holding of from pointing what should be fixed, improved etc. woud be like attending some self-adorable society (which I believe B4A) is not. Is one is offended simply because somebody sugested to add or improve something, then perhaps should not do the job when cannot accept any sugestions or even criticism. Criticism - if it doesn't offer any alternatives or better solutions is definitely destructive, but criticism which can lead to improving things should be welcomed.

Art
 
Last edited:
Upvote 0
Top