Download Source
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+""); } }
This comment has been removed by the author.
ReplyDeleteGood code.
DeletemyTectra Placement Portal is a Web based portal brings Potentials Employers and myTectra Candidates on a common platform for placement assistance
ReplyDeletegood post Thanks!
ReplyDeleteviraltrench
Very informative blog! I liked it and was very helpful for me. Thanks for sharing. Do share more ideas regularly.
ReplyDeleteSpoken English Classes in Chennai
Best Spoken English Classes in Chennai
IELTS Coaching in Chennai
IELTS Coaching Centre in Chennai
English Speaking Classes in Mumbai
English Speaking Course in Mumbai
IELTS Classes in Mumbai
IELTS Coaching in Mumbai
IELTS Coaching in Anna Nagar
Spoken English Class in Anna Nagar
Best MBBS Medical College in Philippines UV Gullas Medical College
ReplyDeleteGreat Article. Thank you for sharing! Really an awesome post for every one.
ReplyDeleteProject Centers in Chennai
JavaScript Training in Chennai
Final Year Project Domains for IT
JavaScript Training in Chennai
Great blog !It is best institute.Top Training institute In chennai
ReplyDeletehttp://chennaitraining.in/openspan-training-in-chennai/
http://chennaitraining.in/uipath-training-in-chennai/
http://chennaitraining.in/automation-anywhere-training-in-chennai/
http://chennaitraining.in/microsoft-azure-training-in-chennai/
http://chennaitraining.in/workday-training-in-chennai/
http://chennaitraining.in/vmware-training-in-chennai/
I enjoyed your blog Thanks for sharing such an informative post. We are also providing the best services click on below links to visit our website.
ReplyDeletedigital marketing company in nagercoil
digital marketing services in nagercoil
digital marketing agency in nagercoil
SEO company in nagercoil
SEO services in nagercoil
social media marketing in nagercoil
social media company in nagercoil
PPC services in nagercoil
digital marketing company in velachery
digital marketing company in velachery
digital marketing services in velachery
digital marketing agency in velachery
SEO company in velachery
SEO services in velachery
social media marketing in velachery
social media company in velachery
PPC services in velachery
online advertisement services in velachery
online advertisement services in nagercoil
web design company in nagercoil
web development company in nagercoil
website design company in nagercoil
website development company in nagercoil
web designing company in nagercoil
website designing company in nagercoil
best web design company in nagercoil
web design company in velachery
web development company in velachery
website design company in velachery
website development company in velachery
web designing company in velachery
website designing company in velachery
best web design company in velachery
Thanks for Sharing - ( Groarz branding solutions )
h productions bandcamp
ReplyDeleteh+ production octapad
h production artistic products
h production abu dhabi
h production racing
Good post thanks for shre article.
ReplyDeletefunny things to ask alexa rtx 2070 vs gtx 1080
This here is really good for all newbie here.
ReplyDeleteThank you for sharing
ReplyDeleteThank you for sharing this valuable information with us.
ReplyDeleteThirukkural pdf download
Sai Satcharitra in malayalam pdf
Sai Satcharitra in marathi pdf
Sai Satcharitra in kannada pdf
Sai Satcharitra in bengali pdf
Sai Satcharitra in gujarati pdf
tamil story books pdf free download
tamil motivational books pdf download
Thank you for amazing blog.
ReplyDeleteYour articles are quite beneficial to me. It is simple to comprehend and instructive. Also, I'd like to recommend a shader pack for Minecraft. You can get the BSL Shaders set here, and I'm sure you'll enjoy it.
ReplyDeleteBSL Shaders
ReplyDeleteI appreciated looking at your article. Very wonderful reveal. we have one of the best hard disk cleaner called WinDirStat which will help you to clean unneeded files from your PC.
ReplyDelete