I want to receive the battery info to a text type and the value of "level" is not accessible outside the broadcast receiver. How to access the value of level out side the broadcast receiver in the code to use it in oncreate method
public BroadcastReceiver mBatInfoReceiver = new BroadcastReceiver(){
@Override
public void onReceive(Context ctxt, Intent intent) {
int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0);
batteryTxt.setText(String.valueOf(level) + "");
}
};