Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create screensaver for cmx #40

Open
Squadzone opened this issue Mar 2, 2013 · 1 comment
Open

create screensaver for cmx #40

Squadzone opened this issue Mar 2, 2013 · 1 comment
Assignees

Comments

@Squadzone
Copy link
Member

use this template as example

package com.yourpackage;

public class ScreenSaverActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // use click or touch listener to finish this activity when user interact with this activity
    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });
     setContentView("your layout");
}

@Override
protected void onResume() {
    super.onResume();
}

@Override
public void onStart() {
    super.onStart();
    IntentFilter s = new IntentFilter();
    s.addAction(Intent.ACTION_SCREEN_ON);
    s.addAction(Intent.ACTION_SCREEN_OFF);
    registerReceiver(mScreenTimeoutListener, new IntentFilter(s));
}

@Override
public void onStop() {
    unregisterReceiver(mScreenTimeoutListener);
    super.onStop();
}

private BroadcastReceiver mScreenTimeoutListener = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
        if (Intent.ACTION_SCREEN_OFF.equals(intent.getAction())) {
            finish();
        }
    }
};

@Override
protected void onPause() {
    super.onPause();
}

}

@ghost ghost assigned TaichiN and thekraven Mar 2, 2013
@TaichiN
Copy link
Member

TaichiN commented Mar 2, 2013

I want...lolcat saver,lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants