// Iterate over the array of active widgets. final int N = appWidgetId dịch - // Iterate over the array of active widgets. final int N = appWidgetId Việt làm thế nào để nói

// Iterate over the array of active

// Iterate over the array of active widgets. final int N = appWidgetIds.length; for (int i = 0; i < N; i++) {
int appWidgetId = appWidgetIds[i];
// Set up the intent that starts the Earthquake // Remote Views Service, which will supply the views // shown in the List View.
Intent intent = new Intent(context, EarthquakeRemoteViewsService.class);
// Add the app widget ID to the intent extras.
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
// Instantiate the RemoteViews object for the App Widget layout.
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.quake_collection_widget);
// Set up the RemoteViews object to use a RemoteViews adapter. views.setRemoteAdapter(R.id.widget_list_view, intent);
// The empty view is displayed when the collection has no items. views.setEmptyView(R.id.widget_list_view, R.id.widget_empty_text);
// Create a Pending Intent template to provide interactivity to // each item displayed within the collection View.
Intent templatelntent = new Intent(context, Earthquake.class); templateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); Pendinglntent templatePendinglntent =
PendingIntent.getActivity(context, 0, templatelntent,
PendingIntent.FLAG_UPDATE_CURRENT);
views.setPendingIntentTemplate(R.id.widget_list_view,
templatePendinglntent);
// Notify the App Widget Manager to update the widget using // the modified remote view.
appWidgetManager.updateAppWidget(appWidgetId, views);
}
}
12. As a final step, enhance the Widget to update whenever the Earthquake Update
Service you created in Chapter 9 has refreshed the earthquake database. Do this by updating the onHandlelntent handler in the EarthquakeUpdateService to call the App Widget Manager’s notifyAppWidgetViewDataChanged method when it has completed:
0/5000
Từ: -
Sang: -
Kết quả (Việt) 1: [Sao chép]
Sao chép!
Iterate qua các mảng hoạt động vật. cuối cùng int N = appWidgetIds.length; cho (int i = 0; i < N; i ++) {}int appWidgetId = appWidgetIds [i];Thiết lập ý định bắt đầu từ trận động đất / / dịch vụ xem từ xa, mà sẽ cung cấp cho các quan điểm / / Hiển thị trong giao diện danh sách.Intent intent = new Intent (bối cảnh, EarthquakeRemoteViewsService.class);Thêm ID Tiện ích của ứng dụng các tính năng bổ sung ý định.intent.putExtra (AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);Nhanh chóng các đối tượng RemoteViews cho bố trí ứng dụng tiện ích.Lượt xem RemoteViews = mới RemoteViews(context.getPackageName(), R.layout.quake_collection_widget);Thiết lập các đối tượng RemoteViews để sử dụng một adapter RemoteViews. views.setRemoteAdapter (R.id.widget_list_view, mục đích);Xem sản phẩm nào được hiển thị khi bộ sưu tập có khoản mục nào. views.setEmptyView (R.id.widget_list_view, R.id.widget_empty_text);Tạo ra một mẫu đang chờ xử lý Intent cung cấp các tương tác để / / mỗi mục Hiển thị trong các bộ sưu tập nhìn.Ý định templatelntent = new Intent (bối cảnh, Earthquake.class); templateIntent.putExtra (AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); Pendinglntent templatePendinglntent =PendingIntent.getActivity (bối cảnh, 0, templatelntent,PendingIntent.FLAG_UPDATE_CURRENT);views.setPendingIntentTemplate (R.id.widget_list_view,templatePendinglntent);Thông báo cho các Widget ứng dụng quản lý để cập nhật các widget bằng cách sử dụng / / điều khiển từ xa lần xem.appWidgetManager.updateAppWidget (appWidgetId, xem);}}12. như một bước cuối cùng, tăng cường các Widget để cập nhật bất cứ khi nào Cập Nhật trận động đấtDịch vụ bạn đã tạo ở chương 9 đã làm mới cơ sở dữ liệu động đất. Làm điều này bằng cách Cập Nhật bộ xử lý onHandlelntent EarthquakeUpdateService để gọi các Widget ứng dụng quản lý notifyAppWidgetViewDataChanged phương pháp khi nó đã hoàn thành:
đang được dịch, vui lòng đợi..
Kết quả (Việt) 2:[Sao chép]
Sao chép!
// Duyệt qua mảng của các vật dụng hoạt động. thức int N = appWidgetIds.length; for (int i = 0; i <N; i ++) {
int appWidgetId = appWidgetIds [i];
// Thiết lập ý định bắt đầu các trận động đất // Dịch vụ xem từ xa, mà sẽ cung cấp các quan điểm // hiển thị trong Danh sách Xem .
ý định ý định = ý định mới (bối cảnh, EarthquakeRemoteViewsService.class);
// Thêm ID widget ứng dụng để bổ sung ý định.
intent.putExtra (AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
// Khởi đối tượng RemoteViews cho cách bố trí ứng dụng widget.
RemoteViews xem = RemoteViews mới (context.getPackageName (), R.layout.quake_collection_widget);
// Thiết lập RemoteViews phản đối sử dụng một bộ chuyển đổi RemoteViews. views.setRemoteAdapter (R.id.widget_list_view, mục đích);
// Cái nhìn trống rỗng được hiển thị khi bộ sưu tập có tin nào. views.setEmptyView (R.id.widget_list_view, R.id.widget_empty_text);
// Tạo một Pending mẫu Ý định để cung cấp các tương tác vào // từng mục hiển thị trong bộ sưu tập View.
Ý định templatelntent = Ý định mới (bối cảnh, Earthquake.class) ; templateIntent.putExtra (AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); Pendinglntent templatePendinglntent =
PendingIntent.getActivity (bối cảnh, 0, Thông báo cho người quản lý ứng dụng Widget để cập nhật tiện ích sử dụng // nhìn từ xa sửa đổi. AppWidgetManager.updateAppWidget (appWidgetId, lượt xem); } } 12. Bước cuối cùng, tăng cường các Widget để cập nhật bất cứ khi nào Update Động đất dịch vụ mà bạn đã tạo ở chương 9 . đã làm mới các cơ sở dữ liệu động đất làm điều này bằng cách cập nhật xử lý onHandlelntent trong EarthquakeUpdateService để gọi phương thức notifyAppWidgetViewDataChanged App widget Manager khi nó đã hoàn thành:









đang được dịch, vui lòng đợi..
 
Các ngôn ngữ khác
Hỗ trợ công cụ dịch thuật: Albania, Amharic, Anh, Armenia, Azerbaijan, Ba Lan, Ba Tư, Bantu, Basque, Belarus, Bengal, Bosnia, Bulgaria, Bồ Đào Nha, Catalan, Cebuano, Chichewa, Corsi, Creole (Haiti), Croatia, Do Thái, Estonia, Filipino, Frisia, Gael Scotland, Galicia, George, Gujarat, Hausa, Hawaii, Hindi, Hmong, Hungary, Hy Lạp, Hà Lan, Hà Lan (Nam Phi), Hàn, Iceland, Igbo, Ireland, Java, Kannada, Kazakh, Khmer, Kinyarwanda, Klingon, Kurd, Kyrgyz, Latinh, Latvia, Litva, Luxembourg, Lào, Macedonia, Malagasy, Malayalam, Malta, Maori, Marathi, Myanmar, Mã Lai, Mông Cổ, Na Uy, Nepal, Nga, Nhật, Odia (Oriya), Pashto, Pháp, Phát hiện ngôn ngữ, Phần Lan, Punjab, Quốc tế ngữ, Rumani, Samoa, Serbia, Sesotho, Shona, Sindhi, Sinhala, Slovak, Slovenia, Somali, Sunda, Swahili, Séc, Tajik, Tamil, Tatar, Telugu, Thái, Thổ Nhĩ Kỳ, Thụy Điển, Tiếng Indonesia, Tiếng Ý, Trung, Trung (Phồn thể), Turkmen, Tây Ban Nha, Ukraina, Urdu, Uyghur, Uzbek, Việt, Xứ Wales, Yiddish, Yoruba, Zulu, Đan Mạch, Đức, Ả Rập, dịch ngôn ngữ.

Copyright ©2025 I Love Translation. All reserved.

E-mail: