I would like to take a photo with MediaStore.ACTION_IMAGE_CAPTURE intent, but disable the settings button in the top-left corner. I was able to find a EXTRA_SHOW_ACTION_ICONS parameter, but it is not well documented. This is the description:
The name of an Intent-extra used to control the UI of a ViewImage. This is a boolean property that specifies whether or not to show action icons.
Even if I set it true or false, nothing changes. What does this parameter do? I use it like this:
takePictureIntent.putExtra(MediaStore.EXTRA_SHOW_ACTION_ICONS, false);
I would like to take a photo with MediaStore.ACTION_IMAGE_CAPTURE intent, but disable the settings button in the top-left corner
As I have pointed out previously, you do not have control over the UI of a third-party camera apps. There are hundreds of such apps; none have to give you any ability to control their UI.
What does this parameter do?
Based on a search of the Android source code, it does nothing in Android itself. If the device happens to have the AOSP Gallery app installed, it appears to control something in the image viewer there. It is certainly possible that some non-AOSP apps use that extra for some particular reason, but that behavior would vary by app.
Related
when I set a view's translationX whether via XML or programmatically android seems to ignore the code.
When I run view.setTranslationX(-200); it ignores the translation and the app shows the view at 200 instead
If I run via post Runnable or overriding onMeasure it can be moved to -200 but it momentarily shows when the app loads. I don't want it to be seen on app start
What can I do to translate view before widget is shown.
When is the earliest I can set translationX?
The view/layout is not inflated yet so you can't.
Do you mind if I ask why you want to do it before the widget is shown?
Please click here to view the screenshot.Please tell me the reason. I can send you the codes if u require.
enter image description here
The design preview will not show any live running code or logic that the device or emulator will. You can override this by adding one of the tools references to the layout, but otherwise it will just use the default data set inside the XML layout attributes.
I'm currently attempting to make an AI that will be able to learn how to play games on Android by actively monitoring certain features pertaining to the pixels on the screen, and how the user interacts with them.
My issue is that I cannot seem to find any relevant information regarding detecting MotionEvents that other applications receive. Are there any standard means by which I could set a global OnTouchEvent hook, thus receiving all user inputs regardless of the application that is active? If there aren't any standard methods, any ideas as to how one could achieve this?
One application can not know anything that is going on inside another application unless that other app has specifically shared that data. This is for security and privacy reasons. (Imagine how unsafe phones would be if any app could know what the user is entering into any other app, such as password.)
You can detect external touch event in your application.
WINDOWS_SERVICE which is system service, can provide you with the information of touch on the Android device, for that you need one layout which should be of unit size of pixel so that it doesn't consumes you click event on external applications.
mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
1, // width is equal to 1px
1, // height is equal to 1px
WindowManager.LayoutParams.TYPE_PHONE, // Type Phone, These are non-application windows providing user interaction with the phone
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | // This window would never get key input focus.
WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, // This window will get outside touch.
PixelFormat.TRANSPARENT // The view will be transparent
);
Now you have to add you layout to this window manager service.
//Adding view to the window manager
mWindowManager.addView(touchLayout, params);
For better explanation with code you can refer this link
http://allinmyspace.com/2016/08/28/android-detect-touch-events-on-external-applications/
Is there a way in ICS or Honeycomb to go completely full screen? I want the system UI completely gone! Currently what I do is:
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
getWindow().getDecorView().setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
But this results in the Status Bar being replaced by really dim dots! I want it completely gone! Lets say for example I want to play a video or show a picture that takes up the whole screen. I'm okay with the status bar coming back on user interaction but I need it completely gone when there is no user interaction.
With the code above. I get the following look:
I want the dim dots gone as well and my video / image to be completely full screen.
This is not possible in Honeycomb, but has been added in API v14. Use:
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
See the more detailed answers over here (though I would use a Build.Version.SDK_INT check instead of the suggested reflection-based check for support):
Hide ICS back home task switcher buttons
As the previous poster Suggested, that is completely impossible without rooting your device and performing some somewhat dirty process kill operations. The reason for is that new Hardware (like a tablet, for instance) may not have hardware buttons for navigation - and so by hiding those buttons the User would have no means of doing things that they are supposed to be guaranteed to be able to do, like going to the home screen, or accessing device info. Whether or not you might agree with that reasoning, such is the API.
The last information I have is that you can use the black tape to cover it. That's the suggestion given by Chet Haase. Watch this google IO 2011 session Q&A starting at 53minutes
You want SYSTEM_UI_FLAG_HIDE_NAVIGATION . Keep in mind that since the soft navigation buttons are key to device experience this only hides the buttons until there is some user interaction. If you want to permanently hide them then rooting the device (as others have suggested) is the only way to go.
The flag was added as of Ice Cream Sandwich, API 14. Previous to 14 a flag STATUS_BAR_HIDDEN was added in Honeycomb, API 11 that had a similar function. Previous to that the soft navigation buttons didn't exist, so fullscreen modes were handled entirely by Themes (specifically Theme.NoTitleBar.Fullscreen).
Use:
if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH )
mBaseLayout.setSystemUiVisibility( View.SYSTEM_UI_FLAG_HIDE_NAVIGATION );
else if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB )
mBaseLayout.setSystemUiVisibility( View.STATUS_BAR_HIDDEN );
I'm trying to add some animations to my application. I've essentially got a few menu screens, that all eventually lead to the main application that is a surface view. I want to add some nice animations between screen like fading in and out between screens. What's the easiest way to do this that is supported by SDK1.5 and above (I want to target most users)?
I'm confused by what is and isn't supported in SDK1.5. My belief at the moment is that animations between different activities is not supported in 1.5 but animations in things like ViewFlipper are. It seems the easiest way is to set up a ViewFlipper, put each of my screens in that, set the animation settings and then use this to get nice transitions.
Also, is there a way to override the "no animations" setting that can be found in the phone's main settings screen under display? I'm making a game, so presentation is important, so I want to be sure that whatever I use will cause an animation regardless of this global setting.
My belief at the moment is that
animations between different
activities is not supported in 1.5 but
animations in things like ViewFlipper
are.
Correct.
It seems the easiest way is to set up
a ViewFlipper, put each of my screens
in that, set the animation settings
and then use this to get nice
transitions.
Either that or just directly apply AlphaAnimation and kin to your Views.
is there a way to override the "no
animations" setting that can be found
in the phone's main settings screen
under display?
No, but bear in mind that is only for inter-activity animations.
I'm making a game, so presentation is
important, so I want to be sure that
whatever I use will cause an animation
regardless of this global setting.
Then do not rely upon global settings. Which, in this case, means do not rely upon inter-activity animations.