How to create a working ViewPager App? - java

I am trying to develop an application which would be a lot better if it had a clean ViewPagerUI. I dont need fancy menus (yet), all I want is that if I start my application It starts out as one relative Layout, and i can then swipe left and right to view two more Relative Layouts.
I have read, watched and studied tons and tons of tutorials in the past week, but they all seem to either be outdated, don't fit my needs (because they create new "pages" with a while/for loop, which is definetely not what i'm looking for), or are way to complicated/ leave out important information( i am a fresh developer, but I really don't want to give up) like the official guide on the android developers webpage.
I get that experienced developers can get a lot out of these tutorials, but I don't find them to be very informative for beginners/newbs.
Questions I asked myself while reading different guides are:
Which differernt java classes/ xml files do I need to create, and which code goes where?
How does the ViewPager know which Fragment I want to display on any page?
How can I add working, "connected" code to all three fragments?
To give you some helpful information:
The first page should display a chart
The second page contains edit texts, which add items to an array and thus to the chart on the first page on button click
The third page contains settings for the chart
I don't need ANY other pages/activities/main menus whatsoever. Only these three interacting pages.
I`ve found it to be the best option to go with relative layouts.
The second page should be the main page.
I am sorry if you think that my issue is dumb, but i am trying to create this app for over a week now, and i seem to not get any traction.
Thanks in advance!

Related

How Do I Make Android WebView Load Page Modal Elements?

I'm trying to make a really simple app for a friend to display his bar's ordering website in an app for when they reopen with the social distancing measures in place. The web app already exists, so this is really a simple matter of displaying the content in a WebView.
I've got the page loading, the content is visible, the styling is done - The only problem is that it doesn't seem to be loading all the elements. There's a line of filters at the top which just display as 3 dots (i.e. loading), and when I click any of the items on the menu, nothing happens. There should be a window pops up asking for a table number etc... If I open this in the Chrome browser on my phone, rather than a webview in the app it works perfectly so I know it isn't the website.
I've done the following;
setJavaScriptEnabled(true);
setJavaScriptCanOpenWindowsAutomatically(true);
setSupportMultipleWindows(true);
I've also turned off safe browsing in the manifest in case that was blocking anything. I have also given the app permissions to use the internet. I can't figure this one out at all and nothing online seems to be helping!
Admittedly I'm a tester (automated, but still), so coding isn't my best suit. I may be missing something really simple here. Any ideas?
Scratch that. For anyone who's interested, I needed to add this line;
setDomStorageEnabled(true);
For such a simple thing it proved impossible to find info on, I just enabled everything until something worked! So hopefully you don't have to do the same if you're looking at this.

Creating an sliding input activity in Android

i am trying to create an activity for users to input data in an android application. Many inputfields are required and i therefore wanted to make them into multiple fullscreen scrollable pages.
Like this only with input fields in each slide
I have downloaded the code from this git: https://github.com/akrajilwar/Android-Intro-Slider-Screen, but i dont know how to put input fields in each of this views. As you can see in the git; each of the sliding pages are different xmls but they have no corresponding java files. All code is in a java file which has a viewPage in it.
I am struggeling to come up with any ideas on how to do this. I cant find something similar any place on the internet and need some advice for how to do this, either building on what they already have done in the git or something completely different.

How to make an Android application to run some UI element above other application?

Sorry if the title is it's not self explanatory.
I'm trying to make an application that can interact with other ones by adding them a graphic element in their UI.
Just like Google does with Google Translate new function.
You can see a graphic example here: EXAMPLE GIVEN
My questions are:
Is that even possible? (I guess it is)
Where can I start searching about this? I haven't seen anything in Androids Developer documentation. I really don't know how to search info about this.
Thank you all.
If you'd like to add a graphic element to your app, I suggest using the Toolbar widget (it's automatically added with the Basic Activity template). There's also the ActionBar, but I think the toolbar is preferred to use (newer).
You can get a better idea about it here.
https://blog.xamarin.com/android-tips-hello-toolbar-goodbye-action-bar/
http://www.101apps.co.za/index.php/articles/using-toolbars-in-your-apps.html/
As far as the behavior of the icons, you'll have to add your own logic to them. Intents (implicit/explicit) are one way to interact with other things.
I hope this helps push you in the right direction.

How to have a Menu always visible across multiple layouts?

I have looked quite a few places but can't seem to find this specific solution. I am interested in creating a menu that will always be visible across every layout/view of the application. This menu would act much like the header/menu of a website that is fixed and always exists across all pages of the site. I assume I can simply create a menu and have it's visibility shown from initialization but I'm not sure if that's the best way. I don't want the user to have to click any other buttons to open the menu, I just want it fixed and constantly visible from the start of the app.
Thank you.
Any help is appreciated.
Fragments, they are a way to define parts of the user interface. They are similar to activities, they have their own lifecycle. They are also closely tied to the life cycle of their parent activity.
You can add them statically by declaring them in your xml manifest and in your layout file
-or-
you can add them dynamically in runtime by creating them as java objects and xml layout files and then add them using the FragmentManager class.
check out the Documentation on the android developer website
https://developer.android.com/guide/components/fragments.html
also, check out some tutorials on youtube, I like these ones especially:
https://www.youtube.com/watch?v=6GyGtCMoR_U&list=PLonJJ3BVjZW4lMlpHgL7UNQSGMERcDzHo
Good Luck!

I have got my HelloListView app working from android.com what is the best way to add information

I wanted to make an app that you can select a country and it comes up with information about the country. I don't know that much about Java i'm hoping that this will help me learn more about java.
I would like this to be an android app
please help me
thanks
CS
edit: I am new to java so can you help me out and give me pointers on how to do this please.
Example: Lets say we have a listview that has the United States, Germany, and the UK
I already have the list view set up. How would i go about making a second view that would let me select the us and give basic information about it?
Unfortunately I am still a little unclear as to what you are asking but as far as I am aware the list view you create should be able handle clicks on it, so if you check out the ListView class in the android SDK there you will need to look for the onClick event you are after. Overload it and put in the code to create (I think you are asking for this) a second activity, to then show your selection. However that might be a bit complex so try and handle the click event first by perhaps a toast message. Then work your way up.
The second activity you could use to show information, or just create a dialog, or another full screen view to show the info.
I commend you for getting ListView to work without knowing Java. I would suggest you learn the language first before jumping into Android apps because the development resources assume that you have a good knowledge of the Java. There are lots of resources on the web for learning Java and you can do it all in the Eclipse environment if you wish.
Good luck!

Categories