I am new to android programming and just starting with the basics following this guide
Android Starting Activity
The app allows the user to input a string and once the user clicks send, it takes you to a new intent displaying the message. Now at the bottom of the link where there are 2 pictures displayed, there is no visible back button, but on my emulator, the "My First App" is a button indicating it can go back. However, if I press it, it crashes the program. Is there anyway to disable the title message from being a button?
If I press the back button on the phone, the program works perfectly fine.
I think the title bar is just a regular view thats located in the android library rather than the res folder associated with your application. You should be able to find the title bar and disable clicks with the following:
View v = findViewById (android.R.id.title);
v.setClickable(false);
That should disable clicks on the title bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
This is the line you are looking for. Mind you, it is commented appropriately, too.
Related
I am making a webview client app for my RSS website. The webview and splashscreen are working great in theme.notitlebar.fullscreen.
Because external links are opening in my webview, i want a back button in the titlebar. But i want to keep the full screen option, to remove the time and notifications, and the device buttons.
What i dont understand: Is it correct that the titlebar includes: the bar with time and notifications - bar with app name, back button and settings (extra) button - the device buttons (if available)?
If that is right. How can i add a new bar into the mainactivity with my webview client, with a back button in it.
I hope you understand my question.
You can use image view. set src to back icon. and finish(); activity on imageview click.
I am customizing the android keyboard after downloading the sample keyboard code from developer.android.com. I want to customize the layout of the popup window after a user made a long press on a given key, onLongPress(key popupKey). Particularly, I want to get ridoff the close button at the end of the popup keys and want to make the window close when the user clicks outside it. But, I can't figure out how to get access to the popup window. Please give me some hints.
I finally figure it out myself and want to share for anyone interested.
I was not able to get the close button and get rid off it. But, what I got easier is creating a PopupWindow having multiple buttons whose labels are the popup characters taken from the key parameter passed to onLongPress().
This way I was able to display only the popup characters and close the window when the user selects on of them or presses outside of the window.
Cheers!
I m making book finder app.
step1: i clicked on search button and activity is waiting for my book title
step2: i input some book title
step3: the focus still stays on this search button, i have to click on screen to make it go away.
is there way to automatically loose focus on last widget i clicked on?
You probably just want to call requestFocus() on your book list whenever a search completes (however, if there are no results, you may want to re-open your search box, or do so after a delay). There is also a OnFocusChangedListener which might be of help if requesting focus on your list after serving up results does't work for some reason.
I am new to Android and I am creating an app in which you have a form which you can save similar to how it is done in the contacts app.
My question is: how should I display "Cancel" and "Done" buttons? Should I even display a "Cancel" button in the first place, since the hardware back button (or the action bar's up-navigation) should suffice?
The screenshot below shows how it is done in the Contacts app, but I am wondering if this is "the way to go", because this way the buttons take a lot of screen space for no reason. On iPhone you have a small "Done" button on the top right (inside the navigation bar / action bar). I tend to do the same for this Android app, but I don't want to do anything that users don't expect.
So can someone please help me out here? :)
For this particular case, put the "Done" in a contextual action bar.
Back does not work as "Cancel" - it should also persist whatever edits made so far.
(Buttons like "Done" and "Cancel" are valid in an alert dialog but that is not the case here.)
In my application, I have set it up in the XML so it is in full screen using
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
Now this works fine when the app opens, however if while using the app, I use the home button to back out of the app, and then open it again, when it opens, a black navigation bar will appear for a second or two before disappearing. This does not occur if I exit the app using the back button, just the home button.
Does anyone know why this happens? I have tried doing it from code instead using
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
//Remove notification bar
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
However, what this does is removes the title bar, but the black bar is there at the top, just nothing is in it.
I.e. this bar
I tried combining the code, by putting the full screen line of code in the XML and also adding the code I showed above into the app, but same thing happens. If I back out of the app with home button and enter it again, that black bar will appear for two seconds temporarily pushing the app and its contents down before righting itself again.
How do I go about fixing this? I have been trying loads of different solutions, but nothing seems to work.
Thanks in advance
Seems to a bug with Android OS. Only way to fix it is go to device, settings animation, and disable animations.
try to remove animation by setting->brightness->animation
set no animation there