No back button in virtual device - java

I am starting into Android I managed to start a simple app I made in a virtual device. Problem: There is no back button in the device.
I am using eclipse ADT and the device says on top: emulator64-arm. Not sure what other information are needed to provide to help me

Your emulator image is emulating a device with a hardware BACK button, and so it does not show up in a navigation bar in the device itself. As was noted in the comments, Esc on your desktop OS will map to BACK in the emulator.
If you want to change your emulator to not have hardware BACK buttons, in ~/.android/avd/.../config.ini (where ... is the name of the AVD), set hw.mainKeys=no.

you can try by edit your AVD by checking "Display a skin with hardware control". after restart your avd back button should show in your virtual device.

Related

How to open an app when its related file is clicked in file explorer?

I have made a music player application in android(java). It's working well but i need to know that whenever i click on a music (.mp3 file) in file manager , music starts getting played in default music player app of my device. I've tried to check out the default music player for playing music in my device settings , but my music player app was not getting show there , only phone music player was showing. Now how to fix this ??
You can click right click the music, then click open with. Assuming you have not published the app you will have to prose for your project file and select your app to open when you click on the music.
If your testing the app use a physical device and play it straight from your phone. Once the app is published and on your phone. File explorer on a computer will not have access to the player in the long run.
It’s always better to test on a physical device so you can make sure everything is correctly laid out.
To test on a device put the phone in developer mode by taping build in settings then about phone and then build repeatedly and turn on OEM and Debug... follow the prompts then plug your phone into the computer.
If you want to test the emulator as a side load then you will have to enable developer mode on the computer by going to settings then update, then select developer mode. Turn it on and restart your computer.
Your app is considered as a side load. So you will have to turn on developer mode within the computer.
Settings > Update > Developer
Then select side loading then restart your computer.
This should allow side loading of your app since it’s not published. However I would recommend testing on a physical device to make sure all layouts are correct and you can play music from the phone.

Android - How to detect when user click recent app?

I want to develop a custom launcher android for Samsung Tablet where user can only exit the launcher with a passcode input.
Currently I face problem in recent app button. If user click recent app button, and then click the recent app, then click backpressed, device will go to TouchWiz launcher even I already set my launcher as a default launcher. Also, I disable the notification bar so user can't access it. However, when it go to TouchWiz via backpressed at recent app, the notification also disable, it should be able when in TouchWiz launcher.
My proposed solution is to detect when user click recent app and forbid any action that can cause the changes of current view.
You can check onWindowFocusChanged method. You Activity will get a callback on this method when you click recent apps or press back button from it. When you click on recent apps hasFocus will be false and when you press back it will be true.
documentation
I can't detect the recent app clicked. So I use onPause() to detect if my app is on foreground or background. If is in onPause() then my app is on background, if so, I do startActivity(myLauncher) so other app won't launched.

Dialog box for Device administration permission Android

I have a screen lock app like if you tap on it, it will turn off the screen. But it needs to be device administrator which I do manually for it. I want it to show a dialog box when you open the app which will take you to the device administrator settings. Like in the image.I want to a button in dialog which will take me here
This should solve your issue. Check it out and see if it fits.
How to open device administrators settings in android?
Generally speaking you need to find if there is an exported activity on your device that let's you call an intent to launch that settings page.

Screenshot is not supported below API 14

I am trying to get a screen shot of the android studio emulator running on API-10. Unfortunately I am getting the following message:
Can anyone explain why is that so and is there any other easy workaround to this except Print Screen (since it does not produce the same image quality and one needs to crop the image manually)?
The solution has been within the Android Studio itself:
1- Click on Android Device Monitor
2- On the left, there is a tab named Devices . Find your emulator name and click on it.
3- In front of the Devices tab there are a set of icons. Find the Screen Capture icon and click on it.
4- After the Device Screen Capture window opens, wait until your emulator's current screen is captured.
5- At last, you can save the quality image by clicking on the Save button.

Android camera button

I am writing a simple android camera application (SDK version 7). Can I handle camera button like in native camera app, i.e. soft click - focus, and hard click - capture photo ?
Be aware that many android devices do not have physical camera button. It is safer bet to allow the way for the users to use touch screen for both focusing and taking photo.
Anyway, since you mention native camera app, I assume you mean the official camera app. In that case, you can find the source code at https://android.googlesource.com/platform/packages/apps/Camera.git

Categories