android-navigation

Setting launchMode=“singleTask” vs setting activity launchMode=“singleTop”

本秂侑毒 提交于 2019-11-28 05:12:46
I have an app that is very hierarchical (activities are similar to League > Team > Position > Player) and so I've made each activity singleTop in order to keep navigation sensible and to prevent duplicate instances. Now I'm making my second app and I've seen it suggested to declare my application to be singleTask to prevent duplicate instances. Could someone help explain the advantages of each approach? My new app is just an activity with 3 fragments and then I'll probably add a settings activity and maybe a FAQ. EDIT: I just realized that singleTask is NOT preventing duplicate instances of my

Block/disable recent apps button

拈花ヽ惹草 提交于 2019-11-28 04:46:47
I know that this question was asked before here Android Disable Recent Task Button like in SureLock , but since the answer there is not working, maybe some can share some light on this forgotten mater. I also tried: private void closeRecents() { activ.sendBroadcast(new Intent("com.android.systemui.recent.action.CLOSE")); Intent closeRecents = new Intent("com.android.systemui.recent.action.TOGGLE_RECENTS"); closeRecents.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); ComponentName recents = new ComponentName(SYSTEM_UI_PACKAGE_NAME, RECENTS_ACTIVITY);

Make navigation drawer draw behind status bar

拈花ヽ惹草 提交于 2019-11-28 03:33:57
I'm trying to create a Nav Drawer like the one from the Material spec (like the one from the new gmail app). Note how the contents of the nav drawer draw behind the status bar: Using Chris Banes' answer from this question , I was able to successfully make the navigation drawer in my app draw behind the status bar; that's working fine. What isn't working is drawing the contents of the nav drawer behind the status bar. I want the blue image in my drawer to be displayed behind the status bar, but that area is drawn with the color of status bar, as seen in this screenshot. So, how can I make my

Android - Navigation Up from Activity to Fragment

拥有回忆 提交于 2019-11-28 01:46:41
问题 I'm developing some application and I have one problem. I have : 1. Activity A (Navigation Drawer pattern) with ListFragment in FrameLayout: xml: <FrameLayout ...> </FrameLayout> <LinearLayout ...> </LinearLayout> </android.support.v4.widget.DrawerLayout> Activity B which shows the detail data of ListView in ListFragment. How can I go back (using Navigation Up Button) from activity B to Activity A with saving UI of the ListFragment (Activity re-creates if I go back using Home Back). Btw, if I

Android parent Navigation Drawer for all activities

纵然是瞬间 提交于 2019-11-27 22:45:33
问题 I am creating an app which requires same Navigation Drawer for all activities. To do so, I have created a class which extends Activity (need for child classes) and written the code for Navigation Drawer there. public class NavigationDrawerClass extends Activity { String [] names = new String[]{"Rohan", "Muthu","Rishi"}; private ActionBarDrawerToggle mDrawerToggle; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.navigation

Android Navigation view: Scroll the menu items only issue

我怕爱的太早我们不能终老 提交于 2019-11-27 18:44:09
问题 I want to scroll only the menu items of the navigation view but it also scroll the header with it. Please any body tell me how to achieve this... Here is my code: activity_main.xml <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" ....... <android.support.design.widget.NavigationView android:id="@+id/navigation_view" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" app:headerLayout="@layout

Change Icon Of Navigation Drawer

别等时光非礼了梦想. 提交于 2019-11-27 18:22:26
I am having trouble with changing my navigation drawer icon to a custom one. I've currently had to implement the standard drawer icon which has 3 horizontal lines on top, but now I want to replace this with my custom drawer icon. This is how my mDrawerToggle is at the moment: mDrawerToggle=new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.app_icon, R.string.drawer_open) { // My code }; Tarun Tak Here is the sample code taken from Creating a Navigation Drawer Activity.class public class MainActivity extends Activity { private DrawerLayout mDrawerLayout; private ActionBarDrawerToggle

How to highlight the item when pressed using BottomNavigationView between activities?

流过昼夜 提交于 2019-11-27 17:42:50
问题 I have added Bottom Navigation View for my app but I need the Bottom Navigation View between activities instead of fragment so I have added this code to Java for all my 3 activities. When I select Second or Third in my phone all things are correct but the problem is the highlight goes to the First item. I need to highlight the item I press. I have used fragment and it works perfectly but I am still beginner for using fragment so I am using activities. The first activity code is:

Must I specify the parent activity name in the Android Manifest?

冷暖自知 提交于 2019-11-27 15:59:41
问题 I have an activity that starts another activity. Is it mandatory that I specify the parent activity in the Android Manifest? Im asking this because there might be other activities that will start this one as well, so should I specify all of them? android:parentActivityName="com.example.myfirstapp.MainActivity" 回答1: As per docs -> section android:parentActivityName : The system reads this attribute to determine which activity should be started when the user presses the Up button in the action

Android Navigation Drawer implemented with Activities

北慕城南 提交于 2019-11-27 14:09:48
I am developing my own Android Application and i came to a point where i have three different Activities say Activity A, Activity B and Activity C. What i want to do now is to create a Navigation Drawer to navigate between them. I read the tutorial on the Android Developers website but they only focused on Fragments. How are professional Android Applications developed only with one Activity and all the other screens are developed with the use of Fragments?If not why isn't documented how to implement correct the navigation drawer with Activities instead?Thank you for your help. You need to