【发布时间】:2017-06-20 00:58:09
【问题描述】:
我有按钮,onclick="weboscio"。
我想在点击时做两件事:
public void web(View view) {
Intent intent = new Intent(this, about.class);
startActivity(intent);
//opens a new layout
还有:
public static void warning(Context context, int id, int titleResId, int textResId, PendingIntent intent) {
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
String title = context.getString(titleResId);
....etc....
// to open a pop-up window
只需将两个空白放入一个活动中,然后在单击按钮时调用它。我搜索了很多,但没有任何用处..我也尝试过:
public static void weboscio(String args[]) {
home something = new something();
something.web();
new something().warning();
它显然只适用于非静态空洞。而且我在 .web(HERE) 和 .warning(HERE) 中也遇到了错误。
weboscio = onclick 功能
home = 主要 java 活动
web = 应该打开新布局的活动
警告 = 活动应该在新布局上显示一些警告
【问题讨论】:
-
home.warning(); -
嘿,我忽略了它,但是,为什么我在新家中遇到错误。警告**(那里)**; - 因为下面的警告有:(Context context, int id, int titleResId, int tex) 而且,它是公共静态和非静态的,工作室不喜欢它需要用实例调用,但我知道该怎么做:(
-
如果您还没有将参数传递给这些函数...
-
我知道,但是如何传递多个参数呢?我试过了,但我得到的只是更多错误:(
-
如果你仍然有问题,你可以发布一个堆栈跟踪...
标签: java android android-activity void