How to modify the listview content in this situation in android? -
I'm working on an alarm application. The structure is complex anyway, it works like this:
The main activity is a fragmenttoobot activity, it has 4 tabs, one piece alarm list.
Then, the alarm alarm is triggered by the manager, it first calls the boardcast receiver, there is a service in the receiver, which starts a new activity, shows information in detail.
And this is what I want to do, when the user onlaps that new activity, then I want to update the alarm list in that piece. How to get it?
Override public null on backpress () {log d. ("Test 1", "Test R1"); Intent = intent ("on_alarm_remove"); LocalBroadcastManager.getInstance (ctx) .sendBroadcast (intent); Super.onBackPressed (); }
In the Alarm tab section In the manifest This is not an accident, but nothing happened, the log has been run in "Test R1" but "Test R" is not. Blessed once again to make sure If that piece is present, then you can get this piece of activity in the id:
@ Override public view creatives (LayoutInfleter Inflator, View Group Container, Bundle Saved InstantState } {Ctx = getActivity (); IntentFilter = New intent filter ("on_alarm_remove"); LocalBroadcastManager.getInstance (ctx) .registerReceiver (mmsage receiver, intent filter); } Private Broadcast Receiver MMSser Receiver = New Broadcast Receiver () {@ Override Public Records on Receive (Context Reference, Intent of Intent) {Log D. ("Test 1", "Test R"); Db.removeRecord (db.getFirstAlarm () alarm_id.); ReloadFragment (); }}; Block public spaces at @ () (If (mMessageReceiver! = Null) LocalBroadcastManager.getInstance (ctx). An irregular receiver (mMessageReceiver); super.onPause ();}
& lt; receiver android: name = "reminder." Remindor frague $ mmssere receiver "/>
backdrop on public block (piece {= f} = getFragmentManager (). FindFragmentById (...) ; // piece id if (f.getClass () == alarmfragment.class) ((alarmfragment) f) .removeRecord (); return;} Super.onBackpressed ();}
Comments
Post a Comment