如何打开其他 class 不扩展 activity onclick 的通知?

How to open other class which doesn't extends activity onclick of the notification?

我有要求,我需要打开 class,它不会扩展 activity/class 本身,而不是 activity 单击通知。我为通知形成以及单击通知后编写的代码。

 public class Services {
        @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
        public void myNotify(Context context) {
            Notification notify = null;
            NotificationManager notif = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);

            Notification.Builder builder = new Notification.Builder(getContext());
            // Large icon appears on the left of the notification
            builder.setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_launcher));
            builder.setTicker("this is ticker text");
            builder.setContentTitle("REX Alert Notification");
            builder.setContentText("You have a new message");
            //adding LED lights to notification
            builder.setDefaults(Notification.DEFAULT_VIBRATE | Notification.DEFAULT_SOUND | Notification.FLAG_SHOW_LIGHTS);
            builder.setLights(0xff00ff00, 300, 100);
            // Hide the notification after its selected
            builder.setAutoCancel(true);


            builder.setOngoing(true);
            builder.build();
            Intent notificationIntent = new Intent(context, AlertView.class);
            PendingIntent pending = PendingIntent.getActivity(getContext(), 0, notificationIntent, 0);
            builder.setContentIntent(pending);
            notify = builder.getNotification();
            notif.notify(0, notify);
        }
    }

因为我作为参数传递给 pendingintent 的 class 不是 class,所以它没有打开。你能告诉我如何实现这个吗?

添加警报视图class:

public static class GenericCallable implements Callable<List<IData>> {
         private final BaseListView    view;

        public GenericCallable(final BaseListView view) {
            this.view = view;
        }

        @Override
        public List<IData> call() throws Exception {
            final IData mData =view.getHeaderData();
            return view.getDataSource().getAll(mData, view.getMaxLength());
        }
    }

    @Override
    public MAUIConfigurationView getSortPopupViewConfig() {
        return ConfigurationManager.getInstance().getView("AlertListSort");
    }
    @Override
    public IDataSource<IData> getDataSourceCallable() {
        return new ArrayDataSource<IData>(new GenericCallable(this));
    }

    @Override
    public int getIntentCode(IData data) {
        return 0xff33;
    }
    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        invalidateList();
    }
}

您可以在未决意图中使用自定义操作意图,然后 do/open 在广播接收器中 do/open 任何您想要的东西 :)

查看此自定义操作意图:

这是广播接收器: