Reputation: 13673
The company I work for asks me to convert their website to an Android app. I am not an expert neither in Java, nor Android SDK. So I do not know what are my options here.
The application looks like this:
So the header (except for the title) and the footer are always constant. And the red parts change to the relevant page when a footer button is clicked.
I know that I should not ask "what is the best approach for this" kind of question. So, how should I do this?
Right now what I'm doing is this:
two static layouts (without activity classes) : header.xml and footer.xml. I <include>
them in the activity layouts (like about_us.xml). footer.xml has buttons, which are hooked to onClick
events. Buttons are like home , about us , references , contact. And the onClick events are like "load_Page_AboutUs"
So there are 4 functions for each page (activity) to load. This is also a problem I guess. If there is a way to do it like : load_page(String activity_name)
I would like it.
But the real problem is :
I have to define all the load_page_x
functions in all the activities.
So if I have 4 activities, I define the below functions in 4 different activities :
public void load_page_about(View view)
{
Intent i = bla();
startActivity(i);
}
public void load_page_references(View view)
{
Intent i = bla();
startActivity(i);
}
// etc..
These set of function definitions exist in all 4 activities. So I think that I'm doing something wrong here. I would appreciate any help to guide me into the right direction. In the end:
What I want is:
onClick
'sMaybe I should design page content parts as .xml files and programmattically include them in the main_layout.xml
is it correct? And how can I do it?
Thanks for any help !
Upvotes: 1
Views: 1536
Reputation: 5971
Fastest way would be using a WebView set its java script enabled and load your index web page to it, and you're done! you might need to modify some css to view it nicely on mobile.
Upvotes: 1