import android.app.Activity;
import android.app.Service;
import android.app.WallpaperManager;
import android.content.Intent;
import android.os.Bundle;
public class Preview extends Activity {
public Preview() {
// TODO Auto-generated constructor stub
}
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
Intent intent = new Intent();
intent.setAction(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
String pkg = Service.class.getPackage().getName();
}
}
我對使用Service.class.getPackage().getName();
感到好奇。我看到包名是得到的。我的問題是使用Service.class。這是什麼意思或什麼對象被訪問。Android在活動中使用服務
這是一個動態壁紙示例。我現在看到你對初始化靜態類型意味着什麼。 .class的使用我最初並不理解。感謝您澄清這一點,它正在初始化另一個.java文件中示例其他地方定義的類Service的靜態成員。 – Giuseppe