back

Problem with back button in my app [closed]

我是研究僧i 提交于 2019-12-02 13:30:07
I want to clear shared preference values when my mobile is switched off? How can you clear SharedPreference when the device is switched off . You can clear it when the device starts thru BraodcastReceiver . public class PhoneStateReceiver extends BroadcastReceiver{ @Override public void onReceive(final Context context, Intent intent) { if(intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){ //Clear your `SharedPreference` here. } } } In your manifest add this: <receiver android:name=".receiver.PhoneStateReceiver"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED"

CakePHP no layout on back and forward button

寵の児 提交于 2019-12-02 10:37:29
We're building a large CMS in CakePHP with a Croogo install incorporated. We've run into an issue recently where the layout is not rendered correctly when users click the back in the browser (or the forward button for that matter). What you end up with is the view (.ctp) file using the blank layout, so no styles, js, etc. Any input or ideas would be much appreciated. Thank you! FYI: modern browsers should cache the page request (cache is enabled), so we're looking at the Auth stuff coz it seems like the first thing that would be called for pages (even cached ones), correct? :S Also: if the

Back button behavior with tabs and ActivityGroup

跟風遠走 提交于 2019-12-02 08:20:21
I have an Activity ( Main ) which shows tabs like this: private void initTabs(){ mTabHost = getTabHost(); // The activity TabHost Intent intent; intent = new Intent().setClass(this, MyGroup.class); setupTab(intent, "tab"); } private void setupTab(Intent intent, final String tag) { View tabview = createTabView(mTabHost.getContext(), tag); TabSpec setContent = mTabHost.newTabSpec(tag).setIndicator(tabview).setContent(intent); mTabHost.addTab(setContent); } private static View createTabView(final Context context, final String text) { View view = LayoutInflater.from(context).inflate(R.layout.tabs

Implementing back button in webview fragment

梦想的初衷 提交于 2019-12-02 08:18:23
I want to implement the back button to my app. I'm using fragments that each show a different webview. Right now if I press the back button, it closes the app no matter where I am. I would like for it to go back, just like a browser. I have my MainActivity.java , fragment1.java , etc up to fragment5.java Here is my MainActivity.java : package com.----; import java.util.Locale; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import

First Back button press not caught when playing a video android

匆匆过客 提交于 2019-12-02 07:12:47
I have a weird error that I cant figure out how to fix . I have a video player - a simple videoview that plays a video. Now I ve implemented logic so that when the user presses the back button - it tells him to press the back button again to exit, and when he does it exits. But the problem is the first back press is not caught! I dont know what is causing this. I Press back once nothing happens, I press again and it shows me the toast that says "Please press back again to exit" and on pressing again it exits. The first one is not caught no matter what I do . This is the code for OnBackPressed(

Javascript move multiple elements to separate div's and back

依然范特西╮ 提交于 2019-12-02 02:34:56
There are 3 videos, placed in 3 separate div's. There also are 3 separate div's, but in other position of a page (lets say contA and contB and contC). I want that if I click on the video1, then video2 and video3 goes to contA and contB, and video1 goes to contC. If I click video1 again, all videos go back to their original position. If I click on video2 (while its in contA), then video1 goes to contA, video3 goes to contB, video2 goes to contC. I have prepared a jsbin demo: Jsbin DEMO Anyone could help? Appreciated! EDIT: (Added a code as requested) HTML: <div id="vid1"> <video id="Video1"

Override Android Back Button

柔情痞子 提交于 2019-12-01 16:59:50
问题 A little info as to why I am attempting to do this: I am using ActivityGroups to open an activity from a tabHost activity and have that new activity stay under the tabs. That part i've got. But when in that new activity, if I use the back button it takes me right out of the tabs activity so I have to click a few times to get back to where I was. Is there a way to set the back button to go to a specific activity rather than killing the current activity window? 回答1: In general, I would advise

Override Android Back Button

隐身守侯 提交于 2019-12-01 16:44:50
A little info as to why I am attempting to do this: I am using ActivityGroups to open an activity from a tabHost activity and have that new activity stay under the tabs. That part i've got. But when in that new activity, if I use the back button it takes me right out of the tabs activity so I have to click a few times to get back to where I was. Is there a way to set the back button to go to a specific activity rather than killing the current activity window? James Lim In general, I would advise against that because it breaks the UX. The user expects the back button to kill the entire window,

Pressing back prefills inputs with value from right before submit

扶醉桌前 提交于 2019-12-01 11:19:57
With the following htlm: <html> <body> <form action="#"> <p><input type="text"></input></p> </form> </body> </html> On load the input has an empty value. Change it to "1" and enter (submit) The page will show a "1" Pressing back will prefill the page with the entered "1" instead of the initial state (empty) My real world application is an asp.net page where the top of the page contains search inputs and the bottom the results. When pressing back the fields are prefilled with values that don't correspond with the values shown in the results shown below. How can I make it so that the browser's

Exit application on “Back” button on WP7

家住魔仙堡 提交于 2019-12-01 05:43:45
I know that in WP7 it is not possible to exit application programatically. So haw can I handle the following need? My MainPage is empty, and has has the only purpose to make a test: if user never filled a preference page, redirects to Page_B.xaml (a page which collects his preferences, such as language aond other info which are needed in order to run the app). Otherwise redirect to Page_A.xaml. So the first page that user is shown is either Page_A or Page_B (depending if this is the first time he/she runs the app). HERE IS THE PROBLEM: when user select the hardware "Back" button while in Page