ウェッジウッドは詳しくないのですが、アプリから別のアプリを立ち上げる場合は
//この部分
Intent(this,yamato.ave.ktidews.ktideView.class);
//例1
Intent i = new Intent(Intent.ACTION_VIEW);
ComponentName componentName = new ComponentName(DEFAULT_PACKAGE, DEFAULT_CLASS);
i.setComponent(componentName);
startActivity(i);
とか
//例2
Intent i = new Intent(Intent.ACTION_MAIN);
componentName = new ComponentName(DEFAULT_PACKAGE, DEFAULT_CLASS);
i.setComponent(componentName);
startActivity(i);
と指定しています。
参考にしてみてください。
MANO
2010年9月11日17:45 大和 <gfa0...@gmail.com>:
> --
> このメールは Google グループのグループ「Android-SDK-Japan」の登録者に送られています。
> このグループに投稿するには、android-...@googlegroups.com にメールを送信してください。
> このグループから退会するには、android-sdk-ja...@googlegroups.com にメールを送信してください。
> 詳細については、http://groups.google.com/group/android-sdk-japan?hl=ja からこのグループにアクセスしてください。
>
>
>
--
******************
(株)ウェブスターシステム
ITソリューション事業部 第3部
翠簾屋 良彦
******************
ここら辺がわかりやすいかと思います。
http://codezine.jp/article/detail/4496
--
//ueno
どうしたいのかソースから読み取るのが難しいのですが、
・AppWidget起動時にサービスを起動させたい
・AppWidgetクリック時にサービスを起動させたい
・サービスからActivityを起動させたい
ということでしょうか。
サービスから Activityを起動させるというのは、どこかのML で見た気がします。
(最近だったと思うのですが、見つけられませんでした。。)
サービスとは関係なく、単に AppWidget をタッチして Activityを起動させたい
のであれば、startActivity() は必要ありません。
(使って起動する方法はあるのかもしれませんが、よく知りません。)
PendingIntent ではサービスではなく、Activityを起動するように
変更すればよいと思います。
AppWidget は普通のアプリとは別物と割り切った方がよさそうです。
--
//ueno
まず、私の勘違いかもしれませんが、Widget と 起動アプリは別にあり
2プログラム(.apk)があると思っていました。
その起動には、ご紹介した2つのアプリ間で起動するstartActivity(i);が参考になると
思っておりました。
ソースを拝見するとWidgetと起動したいActivityは同一アプリ(.apk)にあるように
見受けられます。
Widgetの使い方であれば、次の記事が参考になりそうです。
http://japan.internet.com/developer/20091127/26.html
この記事を見ると、
Intent configIntent =
new Intent(context, ImagesWidgetConfiguration.class);
configIntent.putExtra(
AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
configIntent.setData(Uri.withAppendedPath(Uri.Parse
(ImagesWidgetProvider.URI_SCHEME + "://widget/id/"),
String.valueOf(appWidgetId)));
上記のようなコードで、画面を呼び出しているように見えます。
下記のコードで、OnClickを設定しているように見えます。
PendingIntent pendingIntent = PendingIntent.getActivity
(context, 0, configIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
remoteView.
setOnClickPendingIntent(R.id.config, pendingIntent);
以 上
2010年9月18日8:01 大和 <gfa0...@gmail.com>:
> This kind of launch is configured to open the Debug perpective when it
suspends.
これってEclipseのダイアログですよね?
ブレークポイントで止まってませんか?
> お二人のコメントを参考にして下記を実行しましたがWidgetをクリックするとアボートしてしまいます。
ログ(Exceptionなど)を貼って頂ければ分かるかもしれません。
2010年9月18日8:51 hirokuma ueno <ueno...@gmail.com>:
> --
> このメールは Google グループのグループ「Android-SDK-Japan」の登録者に送られています。
> このグループに投稿するには、android-...@googlegroups.com にメールを送信してください。
> このグループから退会するには、android-sdk-ja...@googlegroups.com にメールを送信してください。
> 詳細については、http://groups.google.com/group/android-sdk-japan?hl=ja からこのグループにアクセスしてください。
>
>
--
塚田 翔也
Shoya Tsukada
tsukada...@gmail.com
Twitter: http://twitter.com/gabu
Blog: http://d.hatena.ne.jp/gabuchan/
Google group: http://groups.google.com/group/android-nagoya-tsubu
ちなみに自分はbuildUpdateで設定してます。
/**
* Builds the update.
*
* @param context the context
*
* @return the remote views
*/
public RemoteViews buildUpdate(Context context) {
DBHelper dbHelper = new DBHelper(context);
RemoteViews views = new RemoteViews(context.getPackageName(),
R.layout.appwidget_provider);
try {
UserListGroup userListGroup =
dbHelper.dbUserListGroup.getDefaultUserListGroup();
if (userListGroup != null) {
List<UserList> userLists =
dbHelper.dbUserList.getUserLists(userListGroup);
List<String> userListsArray = new ArrayList<String>();
int userListsSize = userLists.size();
for (int i = 0; i < userListsSize; i++) {
UserList userList = userLists.get(i);
if (!userList.isCompleted()) {
userListsArray.add(userList.getUserListName());
}
}
int[] lines = {R.id.line0,
R.id.line1,
R.id.line2,
R.id.line3,
R.id.line4,
R.id.line5,
R.id.line6,
R.id.line7,
R.id.line8,
R.id.line9};
int userListsArraySize = userListsArray.size();
for (int i = 0; i < lines.length; i++) {
if (i < userListsArraySize) {
views.setTextViewText(lines[i], userListsArray.get(i));
} else {
views.setTextViewText(lines[i], "");
}
}
}
} finally {
dbHelper.cleanup();
}
Intent intent = new Intent(context, ShoppingListActivity.class);
PendingIntent appIntent = PendingIntent.getActivity(context, 0,
intent, 0);
views.setOnClickPendingIntent(R.id.widget, appIntent);
return views;
}
2010/9/22 abe akio <gfa0...@gmail.com>:
> --
> このメールは Google グループのグループ「Android-SDK-Japan」の登録者に送られています。
> このグループに投稿するには、android-...@googlegroups.com にメールを送信してください。
> このグループから退会するには、android-sdk-ja...@googlegroups.com にメールを送信してください。
> 詳細については、http://groups.google.com/group/android-sdk-japan?hl=ja
> からこのグループにアクセスしてください。
>
--
Hideki Yoshino
hideki....@gmail.com
/* (non-Javadoc)
* @see android.app.Service#onStart(android.content.Intent, int)
*/
@Override
public void onStart(Intent intent, int startId) {
// Build the widget update for today
RemoteViews updateViews = buildUpdate(this);
// Push update for this widget to the home screen
ComponentName thisWidget = new ComponentName(this,
ListWidgetProvider.class);
AppWidgetManager manager = AppWidgetManager.getInstance(this);
manager.updateAppWidget(thisWidget, updateViews);
}
}
2010/9/22 Hideki Yoshino <hideki....@gmail.com>:
--
Hideki Yoshino
hideki....@gmail.com