-4

I try to hide NavigationBar by this code:

public static void setFullscreen(final View decorView) {
    decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
        @Override
        public void onSystemUiVisibilityChange(int visibility) {
            if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
                decorView.setSystemUiVisibility(
                        View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                                | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                                | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                                | View.SYSTEM_UI_FLAG_FULLSCREEN
                                | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
            }

        }
    });

    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
        decorView.setSystemUiVisibility(decorView.getSystemUiVisibility());
    }
}

And for each Activity:

@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    if (hasFocus) {
        getWindow().getDecorView().setSystemUiVisibility(
                View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                        | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                        | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                        | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                        | View.SYSTEM_UI_FLAG_FULLSCREEN
                        | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);}
}

And theme of activities :

<style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="@style/Theme.AppCompat.Light">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">true</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowContentOverlay">@null</item>
</style>

I success to hide NavifationBar , but NavigationBar just invisible , not gone!

So real question is How to gone Navigation bar?

sorry for my poor English.

Iman Marashi
  • 5,593
  • 38
  • 51
  • Use `error_reporting(E_ALL);` and update your question adding the repost please. – Asur May 12 '16 at 21:25
  • Did you try the query (with Workbench or the software you use) and checked the records on the table? – MikeVelazco May 12 '16 at 21:26
  • 2
    Please [stop using `mysql_*` functions](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php). [These extensions](http://php.net/manual/en/migration70.removed-exts-sapis.php) have been removed in PHP 7. Learn about [prepared](http://en.wikipedia.org/wiki/Prepared_statement) statements for [PDO](http://php.net/manual/en/pdo.prepared-statements.php) and [MySQLi](http://php.net/manual/en/mysqli.quickstart.prepared-statements.php) and consider using PDO, [it's really pretty easy](http://jayblanchard.net/demystifying_php_pdo.html). – Jay Blanchard May 12 '16 at 21:34

2 Answers2

5

you dont need a separate query just to get the current time via NOW() you can incorporate it in your query

DELETE FROM current_questions WHERE createTime > NOW() - INTERVAL 1 MINUTE 

that's createTime greater than a minute ago.

Also its important to know that The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead

1

mysql_query function returns a resource.

you still need to go and fetch the data from the resource

$serverTime = mysql_query("SELECT NOW()") or die(mysql_error());
$data = mysql_fetch_array($serverTime);
$serverTime = $data[0]; // and from now it should work.
mysql_query("DELETE FROM current_questions WHERE TIMESTAMPDIFF( MINUTE ,`createTime`,'$serverTime')")or die(mysql_error());

The other answer is better, but it's good to go back and learn from your own mistakes step by step.

Another thing, you should use mysqli extension instead of mysql. That one is older and soon will be deprecated.

Resources:

http://php.net/manual/en/function.mysql-fetch-array.php

http://php.net/manual/en/function.mysql-query.php

Richard
  • 1,045
  • 7
  • 11