public class FlashLightActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);
Context context = this;
PackageManager packageManager = context.getPackageManager();
// if device support camera?
if (packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
//yes
Log.i("camera", "This device has camera!");
}else{
//no
Log.i("camera", "This device has no camera!");
}
}
}
这是用于检查应用程序是否有天气的工作代码FlashLight
,但我如何在其中使用此代码appwidgetprovider
?