Creating an Earthquake Live FolderIn the following example you extend  dịch - Creating an Earthquake Live FolderIn the following example you extend  Việt làm thế nào để nói

Creating an Earthquake Live FolderI

Creating an Earthquake Live Folder
In the following example you extend the Earthquake application again — this time to include a Live Folder that displays the magnitude and location of each quake. The resulting Live Folder is very similar to the Collection View Widget you created earlier in this chapter, making it a useful alterna¬tive for devices running Android releases prior to Android 3.0.
1. Start by modifying the EarthquakeProvider class. Create a new static URI definition that will be used to return the Live Folder items:
public static final Uri LIVE_FOLDER_URI =
Uri.parse("content://com.paad.provider.earthquake/live_folder");
2. Modify the uriMatcher object, and getType method to check for this new URI request:
private static final int QUAKES = 1; private static final int QUAKE_ID = 2;
private static final int SEARCH = 3; private static final int LIVE_FOLDER = 4;
private static final UriMatcher uriMatcher;
//Allocate the UriMatcher object, where a URI ending in 'earthquakes' will //correspond to a request for all earthquakes, and 'earthquakes' with a //trailing '/[rowID]' will represent a single earthquake row. static {
uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
uriMatcher.addURI("com.paad.earthquakeprovider", "earthquakes", QUAKES); uriMatcher.addURI("com.paad.earthquakeprovider", "earthquakes/#", QUAKE_ID); uriMatcher.addURI("com.paad.provider.Earthquake", "live_folder", LIVE_FOLDER);
uriMatcher.addURI("com.paad.earthquakeprovider",
SearchManager.SUGGEST_URI_PATH_QUERY, SEARCH); uriMatcher.addURI("com.paad.earthquakeprovider",
SearchManager.SUGGEST_URI_PATH_QUERY + "/*", SEARCH); uriMatcher.addURI("com.paad.earthquakeprovider", SearchManager.SUGGEST_URI_PATH_SHORTCUT, SEARCH); uriMatcher.addURI("com.paad.earthquakeprovider",
SearchManager.SUGGEST_URI_PATH_SHORTCUT + "/*", SEARCH);
}
©Override
public String getType(Uri uri) { switch (uriMatcher.match(uri)) {
case QUAKES|LIVE_FOLDER: return
0/5000
Từ: -
Sang: -
Kết quả (Việt) 1: [Sao chép]
Sao chép!
Tạo một thư mục trực tiếp của trận động đấtTrong ví dụ sau đây, bạn mở rộng các ứng dụng động đất một lần nữa-thời gian này để bao gồm một thư mục Live sẽ hiển thị cường độ và vị trí của mỗi trận động đất. Thư mục sống kết quả là rất tương tự như các Widget xem bộ sưu tập, bạn tạo ra trước đó trong chương này, làm cho nó một alterna¬tive hữu ích cho các thiết bị chạy Android bản phát hành trước khi Android 3.0.1. bắt đầu bằng cách sửa đổi các lớp học EarthquakeProvider. Tạo ra một định nghĩa URI tĩnh mới sẽ được sử dụng để trở về sống thư mục:khu vực tĩnh cuối cùng Uri LIVE_FOLDER_URI =URI.parse ("content://com.paad.provider.earthquake/live_folder");2. sửa đổi các đối tượng uriMatcher, và getType phương pháp để kiểm tra cho URI yêu cầu mới này:trận động đất riêng int tĩnh cuối cùng = 1; riêng tĩnh cuối cùng int QUAKE_ID = 2; riêng tĩnh cuối cùng int tìm kiếm = 3; riêng tĩnh cuối cùng int LIVE_FOLDER = 4;riêng tĩnh cuối cùng UriMatcher uriMatcher;Phân bổ các đối tượng UriMatcher, nơi một URI kết thúc bằng 'đất' sẽ //correspond để yêu cầu tất cả các trận động đất, và động đất với một //trailing ' / [rowID]' sẽ đại diện cho một hàng duy nhất trận động đất. tĩnh {}uriMatcher = mới UriMatcher(UriMatcher.NO_MATCH);uriMatcher.addURI ("com.paad.earthquakeprovider", "động đất", trận động đất); uriMatcher.addURI ("com.paad.earthquakeprovider", "đất / #", QUAKE_ID); uriMatcher.addURI ("com.paad.provider.Earthquake", "live_folder", LIVE_FOLDER);uriMatcher.addURI ("com.paad.earthquakeprovider",SearchManager.SUGGEST_URI_PATH_QUERY, tìm kiếm); uriMatcher.addURI ("com.paad.earthquakeprovider",SearchManager.SUGGEST_URI_PATH_QUERY + "/ *", tìm); uriMatcher.addURI ("com.paad.earthquakeprovider", SearchManager.SUGGEST_URI_PATH_SHORTCUT, tìm kiếm); uriMatcher.addURI ("com.paad.earthquakeprovider",SearchManager.SUGGEST_URI_PATH_SHORTCUT + "/ *", tìm);}© Ghi đèkhu vực String getType(Uri uri) {switch (uriMatcher.match(uri)) {}trường hợp các trận động đất | LIVE_FOLDER: trở về
đang được dịch, vui lòng đợi..
Kết quả (Việt) 2:[Sao chép]
Sao chép!
Việc tạo ra một trận động đất Sống Thư mục
Trong ví dụ sau bạn mở rộng các ứng dụng động đất một lần nữa - lần này bao gồm một thư mục Live hiển thị cường độ và vị trí của mỗi trận động đất. Các kết quả trực Folder là rất giống với các Bộ sưu tập Xem Widget mà bạn đã tạo trước đó trong chương này, làm cho nó một alterna¬tive hữu ích cho các thiết bị chạy Android ra mắt trước khi Android 3.0.
1. Bắt đầu bằng cách sửa đổi các lớp EarthquakeProvider. Tạo một tĩnh định nghĩa URI mới sẽ được sử dụng để trả lại các mặt hàng trực Folder:
public static thức Uri LIVE_FOLDER_URI =
Uri.parse ( "Nội dung: //com.paad.provider.earthquake/live_folder");
2. Sửa đổi các đối tượng uriMatcher, và phương pháp getType để kiểm tra các yêu cầu URI mới này:
private static int thức trận động đất = 1; private static int thức QUAKE_ID = 2;
private static int thức TÌM KIẾM = 3; private static int thức LIVE_FOLDER = 4;
private static thức UriMatcher uriMatcher;
// Phân bổ các đối tượng UriMatcher, nơi một URI có đuôi 'động đất' sẽ // tương ứng với một yêu cầu cho tất cả các trận động đất, và 'động đất' với một trailing // " / [ROWID] 'sẽ đại diện cho một hàng động đất duy nhất. tĩnh {
uriMatcher = new UriMatcher (UriMatcher.NO_MATCH);
uriMatcher.addURI ( "com.paad.earthquakeprovider", "động đất", động đất); uriMatcher.addURI ( "com.paad.earthquakeprovider", "động đất / #", QUAKE_ID); uriMatcher.addURI ( "com.paad.provider.Earthquake", "live_folder", LIVE_FOLDER);
uriMatcher.addURI ( "com.paad.earthquakeprovider",
SearchManager.SUGGEST_URI_PATH_QUERY TÌM KIẾM); uriMatcher.addURI ( "com.paad.earthquakeprovider",
SearchManager.SUGGEST_URI_PATH_QUERY + "/ *", TÌM KIẾM); uriMatcher.addURI ( "com.paad.earthquakeprovider", SearchManager.SUGGEST_URI_PATH_SHORTCUT TÌM KIẾM); uriMatcher.addURI ( "com.paad.earthquakeprovider",
SearchManager.SUGGEST_URI_PATH_SHORTCUT + "/ *", TÌM KIẾM);
}
© Override
public String getType (Uri uri) {switch (uriMatcher.match (uri)) {
trường hợp động đất | LIVE_FOLDER: trở về
đ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 ©2024 I Love Translation. All reserved.

E-mail: