Create Temperature activity and create instance for android.intent.action.BATTERY_CHANGED intend and register with Temperature Broadcast Receiver
Download Source
Create Temperature Broadcast Receiver
package com.javaorigin.temperature; import android.app.Activity; import android.content.IntentFilter; import android.os.Bundle; import android.widget.TextView; public class TemperatureActivity extends Activity { TemperatureReceiver receiver=new TemperatureReceiver(this); TextView tempDisplay=null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tempDisplay=(TextView) findViewById(R.id.tempDisplay); IntentFilter localIntentFilter = new IntentFilter(); localIntentFilter.addAction("android.intent.action.BATTERY_CHANGED"); registerReceiver(receiver, localIntentFilter); } }
Create Temperature Broadcast Receiver
package com.javaorigin.temperature; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; public class TemperatureReceiver extends BroadcastReceiver{ TemperatureActivity activity=null; public TemperatureReceiver(TemperatureActivity mainActivity) { activity=mainActivity; } @Override public void onReceive(Context arg0, Intent arg1) { activity.tempDisplay.setText(arg1.getIntExtra("temperature", 0)/10.0D+""); } }
Free android game source code:
ReplyDeletehttp://tinyurl.com/freesourcecode
http://tinyurl.com/androidfreesc
New slot machines to play with $50 worth of free coins | DRMCD
ReplyDeleteLooking for new slots machines to play with $50 메이피로출장마사지 worth of free 속초 출장마사지 coins? New 188bet slot machines are coming soon for this 제주 출장샵 exciting 경기도 출장마사지 game, just for fun!