0

//---MySimpleWidget.java---//

public class MySimpleWidget extends AppWidgetProvider {

.
.
.
        @Override
    public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds){
.
.
.

//from here

.
.
.
             }


}

@Override
    public void onReceive(Context context, Intent intent) {

...
}

//---service_test.java---//

public class service_test extends Service {

    @Override
    public IBinder onBind(Intent arg0) {    return null;    }
    @Override
    public void onCreate() {
    ...
    }
    @Override
    @Deprecated
    public void onStart(Intent intent, int startId) {
        //here
    }

}

我是一名安卓初学者。请帮我。

4

1 回答 1

0

将数据放入Intent

Intent intent = new Intent(context, service_test.class); 
intent.putExtra("KEY","VALUE");
context.startService(intent);
于 2013-09-26T03:48:12.137 回答