How to add another Screen inside a Fragment? - java

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"

Related

Android Studio Swipe to Change Screen

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);

Implementing NavigationView in android

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.

How can I animate the opening of a secondary android activity? as on playstore news

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

Button click to show new page

I have a button on an app. Upon clicking this button a new page should appear. The new page will have a list of videos pulled from somewhere online. My problem now:
1. I have the xml page I want to show, and the java class linked to it. I know how to make a button, set an on click listener and make the onClick() method. What do I put into that onClick() method?
2. Help me become more articulate in how I describe Android processes, give me material to read, links to Android documentation. Every time I go into read someting I am overwhelmed; so I've decided to break it down into discrete and manageable tasks. What can I read that will help me understand Android terminology and how applications are ment to function better?
Thank you,
Dave
put in your onClick() method this code:
Intent myIntent = new Intent(CurrentActivity.this, NextActivity.class);
CurrentActivity.this.startActivity(myIntent);
Don't forget to add your new activity in the AndroidManifest.xml:
<activity android:label="#string/app_name" android:name="NextActivity"/>

Trigger Textview when clicked on ListView

I'm a noob Android developer. I learned of the basic UI controls and different types of views that I can utilize.
Now my problem is, I need to show list of items using the ListView that is being shown full screen. when I click on an item it should load a TextView full screen. when I click the back button it should go back to ListView again..
Can someone point me where I can learn such stuff?? any support or even external link is greatly appreciated.
Thanks in advance.
Write your text view in a different activity. And when ever you click on a list item start that activity putting your text in the intent. Fetch the text in that text view activity in onCreate() from the intent and set it to text view. Obviously when ever you click back you 'll come back to list view activity.
Check out this website... http://www.xtensivearts.com/topics/tutorials/
He's no longer updating but what you've asked is covered in the video tutorials he did create. It's not answered directly but by watching them, you should have a solid enough understanding to piece it together yourself.
Best of luck!

Categories

Resources