本文整理汇总了Java中android.hardware.ConsumerIrManager.getCarrierFrequencies方法的典型用法代码示例。如果您正苦于以下问题:Java ConsumerIrManager.getCarrierFrequencies方法的具体用法?Java ConsumerIrManager.getCarrierFrequencies怎么用?Java ConsumerIrManager.getCarrierFrequencies使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.hardware.ConsumerIrManager
的用法示例。
在下文中一共展示了ConsumerIrManager.getCarrierFrequencies方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.hardware.ConsumerIrManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView textView = (TextView)findViewById(R.id.textview);
ConsumerIrManager manager = (ConsumerIrManager) getSystemService(CONSUMER_IR_SERVICE);
StringBuilder builder = new StringBuilder();
builder.append("ConsumerIrManager.hasIrEmitter()=");
builder.append(manager.hasIrEmitter());
Log.d(TAG, "----------------");
Log.d(TAG, builder.toString());
Log.d(TAG, "----------------");
if( manager.hasIrEmitter() == true){
CarrierFrequencyRange[] ranges = manager.getCarrierFrequencies();
for(CarrierFrequencyRange range : ranges){
builder.append(range.getMinFrequency());
builder.append("/");
builder.append(range.getMaxFrequency());
builder.append(" : ");
}
}
textView.setText(builder.toString());
}
示例2: onResume
import android.hardware.ConsumerIrManager; //导入方法依赖的package包/类
@Override
protected void onResume() {
super.onResume();
if (DEBUG) Log.d(TAG, "onResume");
irManager = (ConsumerIrManager)getSystemService(CONSUMER_IR_SERVICE);
boolean hasIrEmitter = irManager.hasIrEmitter();
Log.d(TAG, "hasIrEmitter=" + hasIrEmitter);
if (hasIrEmitter) {
CarrierFrequencyRange[] ranges = irManager.getCarrierFrequencies();
for (CarrierFrequencyRange range: ranges) {
Log.d(TAG, "range"
+ ", max=" + range.getMaxFrequency()
+ ", min=" + range.getMinFrequency()
);
}
}
else {
irManager = null;
Button button = (Button)findViewById(R.id.button);
button.setText("No IrEmitter");
try {
Object c = Class.forName("com.lge.hardware.IRBlaster.IRBlaster");
}
catch (Exception e) {
button.setText(e.toString());
}
}
}