KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I know, there are several questions of this type but I tried all of it and it still doesn't work. Ok, for my app; I've got an Activity. In this Activity, there are 4 Tabs, and the fourth one contents a list and a record button. When I am pushing record, there is a GPS Listener which starts. After getting a new gps value, it pushes it into the list. This works so far! If I click the Home Button it still works, if I longpress it then. It resumes that Activity with the specific Tab open and the list still hold the listitems and the gps listener is still active. This works also fine! Now I wanted to add a notification, which shows the count of gps values of the list as .number. On every new gps signal, it updates the notification icon with the new number. This is no problem, but the action to click on the notification totally screws up my application. The actual code looks like this: public void callNotify(String text) { notif = new Notification(); Intent contentIntent = new Intent(this, tabactivity.class); contentIntent.putExtra("fid", this.specialvalue); contentIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); notif.icon = R.drawable.icon; notif.setLatestEventInfo(this, getString(R.string.app_name), text, PendingIntent.getActivity(this.getBaseContext(), 0, contentIntent, PendingIntent.FLAG_UPDATE_CURRENT)); notif.ledARGB = Color.RED; notif.ledOnMS = 200; notif.ledOffMS = 200; notif.flags = Notification.FLAG_SHOW_LIGHTS | Notification.FLAG_ONGOING_EVENT | Notification.FLAG_ONLY_ALERT_ONCE; notif.number = notifyNumber; mNotificationManager.notify(notifyNumber, notif); } public void updateNotify(String text) { notifyNumber++; notif.number = (int) (notifyNumber / 2); Intent contentIntent = new Intent(this, tabactivity.class); contentIntent.putExtra("fid", this.specialvalue); content
Tags (comma-separated)
Save Edits
Cancel