Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6081243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:09:14+00:00 2026-05-23T11:09:14+00:00

I’ve watched many tutorials now about how to program for Android – I have

  • 0

I’ve watched many tutorials now about how to program for Android – I have even started to create some programs myself. However, I noticed my programs all look like procedural ones, while Java should be working with object orientation. I have been trying to fix this, but I’ve found a problem. The primary class of my program – the one that’s executed at the start of the application (under com.testprogram.www for example) seems to be a mixture of screen and control layers at the same time.

On all tutorials I found, I see a visual object being recovered from the main.xml view (for example, a button – this recovery indicates to me that this would be the ‘control’ layer for treatment) and just after this the object is registered to a listener of some sort (in this case OnClickListener – this should be done in the screen, not in the control, right?).

Is this meant to be this way? This main class under the www package is what? The ‘screen’ layer or the ‘control’ one? Is this class the right place to do what I mentioned above? Is this done this way because the XML-based interface is unable to register Java listeners? Anyone knows a good place for me to go for references on how to OO for Android?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:09:15+00:00Added an answer on May 23, 2026 at 11:09 am

    If you use the standard patterns of layout as xml, strings in strings.xml, activity for handlers and place the core logic/algorithms/data store-retrieval in a separate class (the model class) you will be well on your way to writing better code.

    To test your architecture,

    1) Ask yourself if you can do a unit test on the core logic/algorithm/data store (the model class) separate from the UI. Can you reuse the model class in another project with a different UI without difficulty?

    2) Then ask yourself if you could port your app to another language by simply supplying an optional strings.xml file.

    So the presentation (View) is primarily in main.xml.
    The event and system handling code (Controller) is primarily in MyActivity.java
    The algorithm/data store is primarily in Model.java.

    The really big separation is between the core algorithm/data store and the user interface. The core algorithm/data store should be ignorant of details of the user interface. In UNIX this is the INTERFACE (VC)-ENGINE (M) pattern. Separating out the View from the Controller just takes the architecture one step further.

    Hope that helps,
    JAL

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.