标签:oid button create 参数 lis cli color public err
1 public class MainActivity extends AppCompatActivity { 2 3 @Override 4 protected void onCreate(Bundle savedInstanceState) { 5 super.onCreate(savedInstanceState); 6 setContentView(R.layout.activity_main); 7 8 Button btn1 = findViewById(R.id.btn1); 9 Button btn2 = findViewById(R.id.btn2); 10 11 btn1.setOnClickListener(new View.OnClickListener() { 12 @Override 13 public void onClick(View v) { 14 Intent intent = new Intent(); 15 intent.setAction("hemeiwolong"); 16 intent.setPackage("com.mingrisoft.broadcast"); //如果没有这句,将无法开启广播接收类接收广播,但程序不会崩溃,参数为此activity所在包路径 17 sendBroadcast(intent); 18 } 19 }); 20 } 21 }
标签:oid button create 参数 lis cli color public err
原文地址:https://www.cnblogs.com/hemeiwolong/p/12505707.html