Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

I am glad to post it! After working all night I found something. So, here we go!

1. Create an xml layout file for your notification.

2. Create the notification using the Notification.Builder. After adding everything you want (icons, sounds, etc) do this:

 //R.layout.notification_layout is from step 1 RemoteViews contentView=new RemoteViews(ctx.getPackageName(), R.layout.notification_layout); setListeners(contentView);//look at step 3 notification.contentView = contentView; 

3. Create a method setListeners. Inside this method you have to write this:

 //HelperActivity will be shown at step 4 Intent radio=new Intent(ctx, packagename.youractivity.class); radio.putExtra("AN_ACTION", "do");//if necessary PendingIntent pRadio = PendingIntent.getActivity(ctx, 0, radio, 0); //R.id.radio is a button from the layout which is created at step 2 view.setOnClickPendingIntent(R.id.radio, pRadio); //Follows exactly my code! Intent volume=new Intent(ctx, tsapalos11598712.bill3050.shortcuts.helper.HelperActivity.class); volume.putExtra("DO", "volume");</p> //HERE is the whole trick. Look at pVolume. I used 1 instead of 0. PendingIntent pVolume = PendingIntent.getActivity(ctx, 1, volume, 0); view.setOnClickPendingIntent(R.id.volume, pVolume); 

4. For my requirements I used a HelperActivity which responds to the intents. But for you I don't think it is necessary.

If you want the full source code you can browse it or download it from my git repo. The code is for personal use, so don't expect to read a gorgeous code with a lot of comments. https://github.com/BILLyTheLiTTle/AndroidProject_Shortcuts

ALL THE ABOVE, ANSWERS THE QUESTION OF CATCHING EVENT FROM DIFFERENT BUTTONS.

About canceling the notification I redirect you here

How to clear a notification in AndroidHow to clear a notification in Android

Just remember to use the id you parsed at the notify method when you called the notification for fist time

I am glad to post it! After working all night I found something. So, here we go!

1. Create an xml layout file for your notification.

2. Create the notification using the Notification.Builder. After adding everything you want (icons, sounds, etc) do this:

 //R.layout.notification_layout is from step 1 RemoteViews contentView=new RemoteViews(ctx.getPackageName(), R.layout.notification_layout); setListeners(contentView);//look at step 3 notification.contentView = contentView; 

3. Create a method setListeners. Inside this method you have to write this:

 //HelperActivity will be shown at step 4 Intent radio=new Intent(ctx, packagename.youractivity.class); radio.putExtra("AN_ACTION", "do");//if necessary PendingIntent pRadio = PendingIntent.getActivity(ctx, 0, radio, 0); //R.id.radio is a button from the layout which is created at step 2 view.setOnClickPendingIntent(R.id.radio, pRadio); //Follows exactly my code! Intent volume=new Intent(ctx, tsapalos11598712.bill3050.shortcuts.helper.HelperActivity.class); volume.putExtra("DO", "volume");</p> //HERE is the whole trick. Look at pVolume. I used 1 instead of 0. PendingIntent pVolume = PendingIntent.getActivity(ctx, 1, volume, 0); view.setOnClickPendingIntent(R.id.volume, pVolume); 

4. For my requirements I used a HelperActivity which responds to the intents. But for you I don't think it is necessary.

If you want the full source code you can browse it or download it from my git repo. The code is for personal use, so don't expect to read a gorgeous code with a lot of comments. https://github.com/BILLyTheLiTTle/AndroidProject_Shortcuts

ALL THE ABOVE, ANSWERS THE QUESTION OF CATCHING EVENT FROM DIFFERENT BUTTONS.

About canceling the notification I redirect you here

How to clear a notification in Android

Just remember to use the id you parsed at the notify method when you called the notification for fist time

I am glad to post it! After working all night I found something. So, here we go!

1. Create an xml layout file for your notification.

2. Create the notification using the Notification.Builder. After adding everything you want (icons, sounds, etc) do this:

 //R.layout.notification_layout is from step 1 RemoteViews contentView=new RemoteViews(ctx.getPackageName(), R.layout.notification_layout); setListeners(contentView);//look at step 3 notification.contentView = contentView; 

3. Create a method setListeners. Inside this method you have to write this:

 //HelperActivity will be shown at step 4 Intent radio=new Intent(ctx, packagename.youractivity.class); radio.putExtra("AN_ACTION", "do");//if necessary PendingIntent pRadio = PendingIntent.getActivity(ctx, 0, radio, 0); //R.id.radio is a button from the layout which is created at step 2 view.setOnClickPendingIntent(R.id.radio, pRadio); //Follows exactly my code! Intent volume=new Intent(ctx, tsapalos11598712.bill3050.shortcuts.helper.HelperActivity.class); volume.putExtra("DO", "volume");</p> //HERE is the whole trick. Look at pVolume. I used 1 instead of 0. PendingIntent pVolume = PendingIntent.getActivity(ctx, 1, volume, 0); view.setOnClickPendingIntent(R.id.volume, pVolume); 

4. For my requirements I used a HelperActivity which responds to the intents. But for you I don't think it is necessary.

If you want the full source code you can browse it or download it from my git repo. The code is for personal use, so don't expect to read a gorgeous code with a lot of comments. https://github.com/BILLyTheLiTTle/AndroidProject_Shortcuts

ALL THE ABOVE, ANSWERS THE QUESTION OF CATCHING EVENT FROM DIFFERENT BUTTONS.

About canceling the notification I redirect you here

How to clear a notification in Android

Just remember to use the id you parsed at the notify method when you called the notification for fist time

deleted 170 characters in body
Source Link
LiTTle
  • 1.9k
  • 2
  • 22
  • 40

I am glad to post it! After working all night I found something.So So, here we go! But I am not glad that I had to write it using html, etc! I am feeling like I want to ask a question to stackoverflow, about how to write at stackoverflow!!! Anyway, I hope to help you folks.

1. Create an xml layout file for your notification.1. Create an xml layout file for your notification.

2. Create the notification using the Notification.Builder. After adding everything you want (icons, sounds, etc) do this:2. Create the notification using the Notification.Builder. After adding everything you want (icons, sounds, etc) do this:

  //R.layout.notification_layout is from step 1     RemoteViews contentView=new RemoteViews(ctx.getPackageName(), R.layout.notification_layout);     setListeners(contentView);//look at step 3     notification.contentView = contentView; 

3. Create a method setListeners. Inside this method you have to write this:

//HelperActivity will be shown at step 43. Create a method setListeners. Inside this method you have to write this:

 //HelperActivity will be shown at step 4 Intent radio=new Intent(ctx, packagename.youractivity.class);  radio.putExtra("AN_ACTION", "do");//if necessary    PendingIntent pRadio = PendingIntent.getActivity(ctx, 0, radio, 0);  //R.id.radio is a button from the layout which is created at step 2 view.setOnClickPendingIntent(R.id.radio, pRadio);    //Follows exactly my code!  Intent volume=new Intent(ctx, tsapalos11598712.bill3050.shortcuts.helper.HelperActivity.class);  volume.putExtra("DO", "volume");</p>    //HERE is the whole trick. Look at pVolume. I used 1 instead of 0.  PendingIntent pVolume = PendingIntent.getActivity(ctx, 1, volume, 0);  view.setOnClickPendingIntent(R.id.volume, pVolume); 

4. For my requirements I used a HelperActivity which responds to the intents. But for you I don't think it is necessary.4. For my requirements I used a HelperActivity which responds to the intents. But for you I don't think it is necessary.

About canceling the notification I redirect you here

 

 

How to clear a notification in Android

I am glad to post it! After working all night I found something.So, here we go! But I am not glad that I had to write it using html, etc! I am feeling like I want to ask a question to stackoverflow, about how to write at stackoverflow!!! Anyway, I hope to help you folks.

1. Create an xml layout file for your notification.

2. Create the notification using the Notification.Builder. After adding everything you want (icons, sounds, etc) do this:

 //R.layout.notification_layout is from step 1 RemoteViews contentView=new RemoteViews(ctx.getPackageName(), R.layout.notification_layout); setListeners(contentView);//look at step 3 notification.contentView = contentView; 

3. Create a method setListeners. Inside this method you have to write this:

//HelperActivity will be shown at step 4

Intent radio=new Intent(ctx, packagename.youractivity.class); radio.putExtra("AN_ACTION", "do");//if necessary PendingIntent pRadio = PendingIntent.getActivity(ctx, 0, radio, 0); //R.id.radio is a button from the layout which is created at step 2 view.setOnClickPendingIntent(R.id.radio, pRadio); //Follows exactly my code! Intent volume=new Intent(ctx, tsapalos11598712.bill3050.shortcuts.helper.HelperActivity.class); volume.putExtra("DO", "volume");</p> //HERE is the whole trick. Look at pVolume. I used 1 instead of 0. PendingIntent pVolume = PendingIntent.getActivity(ctx, 1, volume, 0); view.setOnClickPendingIntent(R.id.volume, pVolume); 

4. For my requirements I used a HelperActivity which responds to the intents. But for you I don't think it is necessary.

About canceling the notification I redirect you here

 

How to clear a notification in Android

I am glad to post it! After working all night I found something. So, here we go!

1. Create an xml layout file for your notification.

2. Create the notification using the Notification.Builder. After adding everything you want (icons, sounds, etc) do this:

  //R.layout.notification_layout is from step 1     RemoteViews contentView=new RemoteViews(ctx.getPackageName(), R.layout.notification_layout);     setListeners(contentView);//look at step 3     notification.contentView = contentView; 

3. Create a method setListeners. Inside this method you have to write this:

 //HelperActivity will be shown at step 4 Intent radio=new Intent(ctx, packagename.youractivity.class);  radio.putExtra("AN_ACTION", "do");//if necessary    PendingIntent pRadio = PendingIntent.getActivity(ctx, 0, radio, 0);  //R.id.radio is a button from the layout which is created at step 2 view.setOnClickPendingIntent(R.id.radio, pRadio);    //Follows exactly my code!  Intent volume=new Intent(ctx, tsapalos11598712.bill3050.shortcuts.helper.HelperActivity.class);  volume.putExtra("DO", "volume");</p>    //HERE is the whole trick. Look at pVolume. I used 1 instead of 0.  PendingIntent pVolume = PendingIntent.getActivity(ctx, 1, volume, 0);  view.setOnClickPendingIntent(R.id.volume, pVolume); 

4. For my requirements I used a HelperActivity which responds to the intents. But for you I don't think it is necessary.

About canceling the notification I redirect you here 

How to clear a notification in Android

I am glad to post it! After working all night I found something.So, here we go! But I am not glad that I had to write it using html, etc! I am feeling like I want to ask a question to stackoverflow, about how to write at stackoverflow!!! Anyway, I hope to help you folks.

1. Create an xml layout file for your notification.

2. Create the notification using the Notification.Builder. After adding everything you want (icons, sounds, etc) do this:

 //R.layout.notification_layout is from step 1 RemoteViews contentView=new RemoteViews(ctx.getPackageName(), R.layout.notification_layout); setListeners(contentView);//look at step 3 notification.contentView = contentView; 

3. Create a method setListeners. Inside this method you have to write this:

//HelperActivity will be shown at step 4

Intent radio=new Intent(ctx, packagename.youractivity.class); radio.putExtra("AN_ACTION", "do");//if necessary PendingIntent pRadio = PendingIntent.getActivity(ctx, 0, radio, 0); //R.id.radio is a button from the layout which is created at step 2 view.setOnClickPendingIntent(R.id.radio, pRadio); //Follows exactly my code! Intent volume=new Intent(ctx, tsapalos11598712.bill3050.shortcuts.helper.HelperActivity.class); volume.putExtra("DO", "volume");</p> //HERE is the whole trick. Look at pVolume. I used 1 instead of 0. PendingIntent pVolume = PendingIntent.getActivity(ctx, 1, volume, 0); view.setOnClickPendingIntent(R.id.volume, pVolume); 

4. For my requirements I used a HelperActivity which responds to the intents. But for you I don't think it is necessary.

If you want the full source code you can browse it or download it from my git repo. The code is for personal use, so don't expect to read a gorgeous code with a lot of comments. https://github.com/BILLyTheLiTTle/AndroidProject_Shortcuts

https://github.com/BILLyTheLiTTle/AndroidProject_Shortcuts

ALL THE ABOVE, ANSWERS THE QUESTION OF CATCHING EVENT FROM DIFFERENT BUTTONS.

About canceling the notification I redirect you here (http://stackoverflow.com/questions/2665634/how-to-clear-a-notification-in-android).

How to clear a notification in Android

Just remember to use the id you parsed at the notify method when you called the notification for fist time

I am glad to post it! After working all night I found something.So, here we go! But I am not glad that I had to write it using html, etc! I am feeling like I want to ask a question to stackoverflow, about how to write at stackoverflow!!! Anyway, I hope to help you folks.

1. Create an xml layout file for your notification.

2. Create the notification using the Notification.Builder. After adding everything you want (icons, sounds, etc) do this:

 //R.layout.notification_layout is from step 1 RemoteViews contentView=new RemoteViews(ctx.getPackageName(), R.layout.notification_layout); setListeners(contentView);//look at step 3 notification.contentView = contentView; 

3. Create a method setListeners. Inside this method you have to write this:

//HelperActivity will be shown at step 4

Intent radio=new Intent(ctx, packagename.youractivity.class); radio.putExtra("AN_ACTION", "do");//if necessary PendingIntent pRadio = PendingIntent.getActivity(ctx, 0, radio, 0); //R.id.radio is a button from the layout which is created at step 2 view.setOnClickPendingIntent(R.id.radio, pRadio); //Follows exactly my code! Intent volume=new Intent(ctx, tsapalos11598712.bill3050.shortcuts.helper.HelperActivity.class); volume.putExtra("DO", "volume");</p> //HERE is the whole trick. Look at pVolume. I used 1 instead of 0. PendingIntent pVolume = PendingIntent.getActivity(ctx, 1, volume, 0); view.setOnClickPendingIntent(R.id.volume, pVolume); 

4. For my requirements I used a HelperActivity which responds to the intents. But for you I don't think it is necessary.

If you want the full source code you can browse it or download it from my git repo. The code is for personal use, so don't expect to read a gorgeous code with a lot of comments. https://github.com/BILLyTheLiTTle/AndroidProject_Shortcuts

ALL THE ABOVE, ANSWERS THE QUESTION OF CATCHING EVENT FROM DIFFERENT BUTTONS.

About canceling the notification I redirect you here (http://stackoverflow.com/questions/2665634/how-to-clear-a-notification-in-android). Just remember to use the id you parsed at the notify method when you called the notification for fist time

I am glad to post it! After working all night I found something.So, here we go! But I am not glad that I had to write it using html, etc! I am feeling like I want to ask a question to stackoverflow, about how to write at stackoverflow!!! Anyway, I hope to help you folks.

1. Create an xml layout file for your notification.

2. Create the notification using the Notification.Builder. After adding everything you want (icons, sounds, etc) do this:

 //R.layout.notification_layout is from step 1 RemoteViews contentView=new RemoteViews(ctx.getPackageName(), R.layout.notification_layout); setListeners(contentView);//look at step 3 notification.contentView = contentView; 

3. Create a method setListeners. Inside this method you have to write this:

//HelperActivity will be shown at step 4

Intent radio=new Intent(ctx, packagename.youractivity.class); radio.putExtra("AN_ACTION", "do");//if necessary PendingIntent pRadio = PendingIntent.getActivity(ctx, 0, radio, 0); //R.id.radio is a button from the layout which is created at step 2 view.setOnClickPendingIntent(R.id.radio, pRadio); //Follows exactly my code! Intent volume=new Intent(ctx, tsapalos11598712.bill3050.shortcuts.helper.HelperActivity.class); volume.putExtra("DO", "volume");</p> //HERE is the whole trick. Look at pVolume. I used 1 instead of 0. PendingIntent pVolume = PendingIntent.getActivity(ctx, 1, volume, 0); view.setOnClickPendingIntent(R.id.volume, pVolume); 

4. For my requirements I used a HelperActivity which responds to the intents. But for you I don't think it is necessary.

If you want the full source code you can browse it or download it from my git repo. The code is for personal use, so don't expect to read a gorgeous code with a lot of comments. https://github.com/BILLyTheLiTTle/AndroidProject_Shortcuts

ALL THE ABOVE, ANSWERS THE QUESTION OF CATCHING EVENT FROM DIFFERENT BUTTONS.

About canceling the notification I redirect you here

How to clear a notification in Android

Just remember to use the id you parsed at the notify method when you called the notification for fist time

added 23 characters in body
Source Link
hunterp
  • 16.1k
  • 18
  • 69
  • 121
Loading
Format code to make it readable
Source Link
hunterp
  • 16.1k
  • 18
  • 69
  • 121
Loading
I should have written this way from the begg
Source Link
LiTTle
  • 1.9k
  • 2
  • 22
  • 40
Loading
Source Link
LiTTle
  • 1.9k
  • 2
  • 22
  • 40
Loading