// --- --- 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
}
}
我是一个Android初学者。 请帮帮我。
答案 0 :(得分:0)
将数据放入Intent
Intent intent = new Intent(context, service_test.class);
intent.putExtra("KEY","VALUE");
context.startService(intent);