• 大小: 3.33M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2020-12-24
  • 标签: 壁纸  

资源简介

一款还不错的静态壁纸代码


核心代码:

package com.example.wallpaperchange;

import android.os.Bundle;
import android.app.Activity;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
 
public class MainActivity extends Activity {

	AlarmManager aManager;
	Button start,stop;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        start = (Button)findViewById(R.id.start);
        stop  = (Button)findViewById(R.id.stop);
        
        aManager = (AlarmManager)getSystemService(Service.ALARM_SERVICE);
        
        //指定ChangeService组件
        Intent intent = new Intent(MainActivity.this,ChangeService.class);
        
        //创建PendingIntent对象
        final PendingIntent pi = PendingIntent.getService(
        		MainActivity.this, 0, intent, 0);
        start.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				aManager.setRepeating(AlarmManager.RTC_WAKEUP, 0, 5000, pi);
				
				start.setEnabled(false);
				
				stop.setEnabled(true);
				Toast.makeText(MainActivity.this, "壁纸定时更换启动成功", 5000).show();
			}
		});
        
        stop.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				start.setEnabled(true);
				stop.setEnabled(false);
				
				aManager.cancel(pi);
			}
		});
        
        
    }

    
}

资源截图

代码片段和文件信息

/** Automatically generated file. DO NOT MODIFY */
package com.example.wallpaperchange;

public final class BuildConfig {
    public final static boolean DEBUG = true;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-04-07 20:40  WallPaperChange\
     文件         364  2013-03-19 11:04  WallPaperChange\.classpath
     文件         851  2013-03-19 11:04  WallPaperChange\.project
     文件         934  2013-03-19 12:42  WallPaperChange\AndroidManifest.xml
     目录           0  2013-04-07 20:40  WallPaperChange\assets\
     目录           0  2013-04-07 20:40  WallPaperChange\bin\
     文件         934  2013-03-19 12:42  WallPaperChange\bin\AndroidManifest.xml
     目录           0  2013-04-07 20:40  WallPaperChange\bin\classes\
     文件      328412  2013-03-19 12:43  WallPaperChange\bin\classes.dex
     目录           0  2013-04-07 20:40  WallPaperChange\bin\classes\com\
     目录           0  2013-04-07 20:40  WallPaperChange\bin\classes\com\example\
     目录           0  2013-04-07 20:40  WallPaperChange\bin\classes\com\example\wallpaperchange\
     文件         363  2013-04-07 15:31  WallPaperChange\bin\classes\com\example\wallpaperchange\BuildConfig.class
     文件        1324  2013-04-07 15:31  WallPaperChange\bin\classes\com\example\wallpaperchange\ChangeService.class
     文件        1420  2013-04-07 15:31  WallPaperChange\bin\classes\com\example\wallpaperchange\MainActivity$1.class
     文件        1201  2013-04-07 15:31  WallPaperChange\bin\classes\com\example\wallpaperchange\MainActivity$2.class
     文件        1736  2013-04-07 15:31  WallPaperChange\bin\classes\com\example\wallpaperchange\MainActivity.class
     文件         367  2013-04-07 15:31  WallPaperChange\bin\classes\com\example\wallpaperchange\R$attr.class
     文件         502  2013-04-07 15:31  WallPaperChange\bin\classes\com\example\wallpaperchange\R$dimen.class
     文件         654  2013-04-07 15:31  WallPaperChange\bin\classes\com\example\wallpaperchange\R$drawable.class
     文件         475  2013-04-07 15:31  WallPaperChange\bin\classes\com\example\wallpaperchange\R$id.class
     文件         430  2013-04-07 15:31  WallPaperChange\bin\classes\com\example\wallpaperchange\R$layout.class
     文件         424  2013-04-07 15:31  WallPaperChange\bin\classes\com\example\wallpaperchange\R$menu.class
     文件         540  2013-04-07 15:31  WallPaperChange\bin\classes\com\example\wallpaperchange\R$string.class
     文件         422  2013-04-07 15:31  WallPaperChange\bin\classes\com\example\wallpaperchange\R$style.class
     文件         763  2013-04-07 15:31  WallPaperChange\bin\classes\com\example\wallpaperchange\R.class
     文件         119  2013-04-07 15:32  WallPaperChange\bin\jarlist.cache
     目录           0  2013-04-07 20:40  WallPaperChange\bin\res\
     文件      977855  2013-03-19 12:42  WallPaperChange\bin\resources.ap_
     目录           0  2013-04-07 20:40  WallPaperChange\bin\res\drawable-hdpi\
     文件         409  2013-03-19 12:15  WallPaperChange\bin\res\drawable-hdpi\ic_action_search.png
............此处省略54个文件信息

评论

共有 条评论