随笔分类 - 01安卓开发知识体系-Android基础知识
摘要:一、使用Broadcast Reciver1.右击java文件夹,new->other->Broadcast Receiver后会在AndroidManifest.xml文件中生成一个receiver项 ...
阅读全文
摘要:一、跨应用启动ServiceIntent serviceIntent=new Intent();serviceIntent.setComponent(new ComponentName("com.example.shiyanshi.startservicefromanotherapp","com.e...
阅读全文
摘要:一、启动Service并传递参数传递参数时只需在startService启动的Intent中传入数据便可,接收参数时可在onStartCommand函数中通过读取第一个参数Intent的内容来实现1.MainActivity.javapackage com.example.shiyanshi.ser...
阅读全文
摘要:一、使用Service1.右击java文件夹,选择新建Service,然后重写其中的onStartCommand函数,只要执行了startService函数,onStartCommand便会被执行package com.example.shiyanshi.learnservice;import an...
阅读全文
摘要:一、Context的作用Context可用于访问全局资源.public class MainActivity extends Activity { private TextView tv; @Override protected void onCreate(Bundle sa...
阅读全文
摘要:一、显示Intent startActivity(new Intent(MainActivity.this,BAty.class)); 显示Intent直接指定要启动的Intent类 注意自己通过创建一个java类,然后让其继承Activity时,只需在该类中添加onCreate重载函数,然后...
阅读全文
摘要:一、标准模式(standrard)1.当新建一个Activity时,默认情况下就是标准模式,也可以通过AndroidManifest文件显示指定其launchMode为standard ...
阅读全文
摘要:1.主Activity,用于启动另一个Activity()public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { ...
阅读全文

浙公网安备 33010602011771号