Although I was able to accomplish this task but in opinion the approach is not good,Since am creating instance of the Activity inside Broadcast Receiver. Is there any better way to accomplish it?
@Override
public void onReceive(Context context, Intent intent) {
String receivedIntent = intent.getAction();
MainActivity inst = MainActivity.instance();
setPref(context);
if(m_Accactive){
if (receivedIntent.equals(IntentManager.ACCELEROMETER_DATA_FILTER)) {
Log.d("Accel", "acc data");
recAcc = (AccelerometerClass) intent
.getSerializableExtra(Constants.ACC_DATA_KEY);
recData = recAcc;
if (inst != null) {
m_AccRate = inst.getM_AccFreq();
m_AccRetrieveTxtForm = FormatToString(recAcc);
inst.textViewSettings(inst.m_AcceleroReading, R.id.AccData,
m_AccRetrieveTxtForm);
}
}
}