我使用了这个来源:https://looksok.wordpress.com/2012/12/15/android-complete-widget-tutorial-including-source-code/
在完成本教程后,意图不起作用。什么都没发生。 我的一些代码:
import pandas as pd
a = [1,2,3]
i = [5,2,3]
df = pd.DataFrame( { "foo" : i, "bar" : a } )
df = df.set_index("foo")
l = df.values.tolist()
# l = [[1], [2], [3]]
在另一个java文件中:
public static PendingIntent buildButtonPendingIntent(Context context) {
Intent intent = new Intent();
intent.setAction("com.companyname.intent.action.CHANGE_PICTURE");
return PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
}
这里调用buildButtonPendingIntent:
public void onReceive(Context context, Intent intent) {
if(intent.getAction().equals("com.companyname.intent.action.CHANGE_PICTURE")){
updateWidgetPictureAndButtonListener(context);
}
}
清单文件:(某些部分)
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds) {
RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget);
remoteViews.setOnClickPendingIntent(R.id.widget_button, buildButtonPendingIntent(context));
pushWidgetUpdate(context, remoteViews);
}