I try to create my nice widget but I'm locked in a problem of button.
this an example of code:
public class MyWidget extends AppWidgetProvider {
public void onUpdate(Context context, AppWidgetManager
appWidgetManager,
int[] appWidgetIds) {
Cursor c =
context.getContentResolver().query(Uri.parse("content://...."), null,
null ,null,null);
String Data1 = null;
String Data2 = null;
String Data3 = null;
if(c.moveToFirst()) {
Data1 =
c.getString(c.getColumnIndexOrThrow("Data1")).toString();
Data2 =
c.getString(c.getColumnIndexOrThrow("Data2")).toString();
Data3 =
c.getString(c.getColumnIndexOrThrow("Data3")).toString();
}
c.close();
RemoteViews updateViews = new
RemoteViews(context.getPackageName(),
R.layout.widget_layout);
updateViews.setTextColor(R.id.text, 0xFF000000);
updateViews.setTextViewText(R.id.text,Data1+'\n'+Data2+'\n'+Data3);
ComponentName thisWidget = new ComponentName(context,
MyWidget.class);
appWidgetManager.updateAppWidget(thisWidget, updateViews);
Intent intent = new Intent(context, ActNext.class);
PendingIntent pendingIntent =
PendingIntent.getActivity(context, 0, intent, 0);
RemoteViews views = new RemoteViews(context.getPackageName(),
R.layout.widget_layout);
views.setOnClickPendingIntent(R.id.next,
pendingIntent);
}
}
This what I want, When I clik, I want to show what's next in my data
base. After a long search I now that I have to use
setOnClickPendingIntent.
Here are my 3 questions:
1- What should I write in ActNext classe to move my cursor on next
position
2- Can I write this class at the same place as an under class or
should I create a new class in my project?
3- What need I to declare in the manifest about the Intent filter
(depend on the class created)?
Befor your answer I want to thank's Mark Murphy for his book which has
nicely been translate in french.
Thanks for reading me
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en