Hello I am pretty new to Android Studio and I was looking but could not find out how to make app functionality so I can change the screen of my app by swiping any help of links or videos is greatly appreciated thanks!
You can check out ViewPager for that matter. It's used hand in hand with Fragments so I suggest, if you haven't, that you look into that too.
You'll need to make a recycleView list. Then you'll need to override the swipe handlers. Then you'll need to program the onSwipe() method to change the activity. Screens can be changed like so:
Intent myIntent = new Intent(v.getContext(), activity_main.class);
startActivity(myIntent);
Related
I'm new to Android programming, and I have some questions about what type of layout to use. I am developing an application and have already done a basic mock-up of the interaction I want the user to have.
Following some tutorials I managed to build an app with a Bottom Navigation Bar with 3 Fragments, each one with it's own view. But my goals is that when the user clicks a button on one of these Fragments, the application opens a new View on the same Fragment.
What is the best way to achieve this goal? I have attached an image of the mock-up I made below, hope it helps to clarify the question. Thank you in advance for taking the time to help me!
Link to the mock-up app
That's sounds like you want to start a new Activity.
Considering you have your fragments in CurrentActivity and you want to start InvokingActivity
On clicking button in CurrentActivity
onClickMethod(View v){
Intent intent = new Intent(CurrentActivity.this, InvokingActivity.class)
//put some extras if you like
startActivity(intent)
}
To get arrow in top left corner you need to update AndroidMainfest by adding to InvokingActivity
android:parentActivityName="CurrentActivity"
I am doing a small game, and at the first screen I have made a loading screen. After that I made a second screen. My problem that when I use the emulator it stays on the first screen which is the loading screen. What should I do to connect the first screen with the second?
NOTE: I am using Android Studio, and there is no buttons on the first screen.
If anyone could suggest a video tutorial for my problem, that would be awesome.
Thanks!
You need to have some trigger to call another activity, which in your case it might be when all your data is loaded. It could be something like this:
while(yourDataIsNotLoaded){
//your loading code inside here
}
Intent i = new Intent(getApplicationContext(), SecondActivity.class);
startActivity(i);
Considering that the second screen refers to SecondActivty.
i am working on a project and i happen to implement the "NavigationView" from the Google's Design Compat Library. But i ran into this problem where when an item is touched: i want it to change the activity.
So, what i am implying here is that can anyone give me the best solution of how i can implement this the right way like it is seen in the GMAIL app, where only the toolbar's title and the items in the List also changes.
I tried:
switch(menuItem.getitemId()){
menuItem.setChecked(true);
case R.id.navigation_item_1:
startActivity(new Intent(MainActivity.this, Feeds.class));
But the result isn't what i wanted, Please can you help me.
The comportement you describe (i.e. keeping the actionbar and other stuff), take advantage of fragments and not activities : each time an action is clicked, the displayed fragment is changed, but the activity is still the same one.
Although I do know how to open another activity quite easily, using intent like the below:
Intent intent = new Intent(first.this, second.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
intent.putExtra("selectedApp", ApplicationTitle.getText());
startActivity(intent);
When you use the android application "PlayStore News", when you select a news item rather than just being redirected to another activity. An animation occurs, where in the change between several small cards to one large occurs.
How can I accomplish this?
http://www.mysamplecode.com/2013/02/android-animation-switching-activity.html
There is a method
overridePendingTransition(R.anim.push_up_in, R.anim.push_up_out);
You might want to check out https://developer.android.com/training/material/animations.html#Transitions
This explains how to define custom transitions between activities. In particular, you may be interested in shared element transitions. I'd be more specific, but its a fairly broad question
Check this sample code for animation while switching activities in android.
http://android-er.blogspot.in/2013/04/custom-animation-while-switching.html
http://www.mysamplecode.com/2013/02/android-animation-switching-activity.html
Firstly, I'm new to Android (so I apologize if this question is ignorant) but have some experience in Java. I have been reading a book on Android and remain slightly confused about the basic components (activities, intent, content providers, and broadcast receivers).
I have a few java classes that I'm wanting to convert over to Android but I'm not sure what type of components they should be.
If a class does simple conversions, should that be an intent?
Or, if a class draws, should it be an activity?
I'm just looking for someone who can explain the components a bit better than the references at android and perhaps give some good examples of each component.
I think you're confused about some of the terminology. An activity is what the user interacts with (displays the content, contains the listeners for buttons, etc.) So when you launch an app and see something on the screen, an Activity is what draws all the buttons/components on screen and contains the code for user interaction. An intent is kind of a way to tell activity to launch something else. For example, if you were on your main activity, and wanted to change the Activity when the user clicked something, you would create and start an intent specifying that:
Intent intent = new Intent(CurrentActivity.this, NextActivity.class);
startActivity(intent);
Read this basic tutorial. It should be somewhat clearer than the official docs.
http://androiddevelopertips.com/activity/understanding-activities-in-android.html