使用intellij 14, linux平台
下面是部分程序
package com.test.broadcastbestpractice.app;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import android.view.View;
import android.widget.Button;
public class MainActivity extends BaseActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(this);
Button forceOffline = (Button) findViewById(R.id.force_offline);
forceOffline.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent("com.test.broadcastbestpractice.FORCE_OFFLINE")