android-activity

Disabling right drawer only on specific fragment

心不动则不痛 提交于 2020-01-03 11:13:08
问题 I have Activity with DrawerLayout (which contains left and right drawer). I was wondering if I could disable right drawer from specific fragments. I've read about mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED) , but it would lock whole drawer closed, and I still need the left drawer 回答1: DrawerLayout.setDrawerLockMode(int lockMode) locks all the drawers, but to lock a specific drawer you can use one of the following: DrawerLayout.setDrawerLockMode(int lockMode, int

onCreate called after onActivityResult when I pick picture from gallery

主宰稳场 提交于 2020-01-03 10:44:19
问题 I have 'SherlockFragmentActivity' with overrided 'onActivityResult'. I try to get image from camera and gallery and crop it. The problem is I returned on my activity not fragment after onActivityResult called. ... FragmentTransaction t = fragmentManager.beginTransaction(); LogInFragment logFrag = new LogInFragment(); t.replace(R.id.fragment_container, logFrag); t.commit(); ... @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult

setting screenOrientation in AndroidManifest.xml does not work

天涯浪子 提交于 2020-01-03 08:59:33
问题 I have a simple hello world Android testing project. In my AndroidManifest.xml, I already set android:screenOrientation="portrait" android:configChanges="keyboardHidden|keyboard|orientation"> but when I debug my code, the variable isLandscape is True when it should supposed to be False boolean isLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; I know that I can also set the activity orientation by code, but I need to set it in xml for some

Navigation drawer with Activity and child Fragments

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-03 08:48:15
问题 I have a Activity A , a ListFragment P and 2 Fragments Q and R . When the app is launched, A is created, which loads P . Based on what user clicks, it is replaced by Q or R . Now by referencing this tutorial, I have implemented a Navigation Drawer which shows certain items to the user. However, since I have implemented the Navigation Drawer in the Activity, it shows for all the Fragments. I want it to be only available to P . (Very much similar to Googles Gmail app. When the user is on the

Android onActivityResult called early

此生再无相见时 提交于 2020-01-03 08:36:10
问题 I have 2 Activities, each in seperate applications. Activity1 has a button the user can click and it calls the second activity using an intent in its onClick() method: Intent myIntent = getPackageManager().getLaunchIntentForPackage(com.myProject.Activity2); startActivityForResult(myIntent, 600); This correctly launches Activity2 from Activity1, but onActivityResult gets called in Activity1 before onCreate gets called in Activity2, instead of in onBackPressed() where I set up the return intent

How to pass Objects between activities

£可爱£侵袭症+ 提交于 2020-01-03 06:39:35
问题 I have a feed object, that is filled with deserialized json data. I am trying to pass a feed object between 2 xamarin android activities. How can I accomplish this? I am aware of putseriazable but i'm not sure how to implement this. public class Feed { public class Author { public int id { get; set; } public string slug { get; set; } public string name { get; set; } public string first_name { get; set; } public string last_name { get; set; } public string nickname { get; set; } public string

Filter list not reappearing after empty view shown

不想你离开。 提交于 2020-01-03 05:57:36
问题 For some reason after being shown an empty view for no matching items, my list view won't reappear after removing all text from the search view. Within my adapter class, AFAIK .clear() in mData.clear(); needs to change to something else but I don't know what to. ItemListAdapter class public class ItemListAdapter extends BaseAdapter implements Filterable { private List<Victoria> mData; private List<Victoria> mFilteredData; private LayoutInflater mInflater; private ItemFilter mFilter; public

Activity as dialog using HoloEverywhere cuts off layout

≡放荡痞女 提交于 2020-01-03 05:45:20
问题 I'm using the HoloEverywhere library in my Android app to ensure a consistent theme across all supported devices. However, I'm running into trouble with activities that utilize Holo.Theme.Dialog: on my Android 2.2 emulator it displays correctly, but on my Android 4 device (which has the actual Holo theme available) the layout cuts off items on the right edge of the dialog. My question is, how can I force devices that have the stock Holo theme to use that instead of HoleEverywhere ? Or, how

Expandable list view

↘锁芯ラ 提交于 2020-01-03 05:31:39
问题 i am newbie in android development.. i m using expandable listview , In each row of listview i have 3 textview and 1 button ,on button click i want selected child data to be on another activity with his Group header name is that possible in Expandable list view if its then how ? please help... 回答1: For expandable list just implement following code: ExpandableListDemo.java public class ExpandableListDemo extends Activity { private ExpandableListView expandableListView; private ArrayList<Places

Finish Activity not close in Android (Xamarin)

為{幸葍}努か 提交于 2020-01-03 05:15:11
问题 I have Two Activity one is InventoryActivity and Second is StoneDetailActivity . In my InventoryActivity have RecycleView In RecycleView Button Click I start the StoneDetailActivity using StartActivityForResult below code. Intent stonedetailIntent = new Intent(context, typeof(StoneDetailActivity)); stonedetailIntent.PutExtra("SearchitemObject", stoneJson); stonedetailIntent.PutExtra("position", position); context.StartActivityForResult(stonedetailIntent, 1000); context