當前位置: 首頁>>代碼示例>>Java>>正文


Java TrafficStats.clearThreadStatsTag方法代碼示例

本文整理匯總了Java中android.net.TrafficStats.clearThreadStatsTag方法的典型用法代碼示例。如果您正苦於以下問題:Java TrafficStats.clearThreadStatsTag方法的具體用法?Java TrafficStats.clearThreadStatsTag怎麽用?Java TrafficStats.clearThreadStatsTag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.net.TrafficStats的用法示例。


在下文中一共展示了TrafficStats.clearThreadStatsTag方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: performRequest

import android.net.TrafficStats; //導入方法依賴的package包/類
@Override
public HttpResponse performRequest(Request<?> request, Map<String, String> additionalHeaders) throws IOException, AuthFailureError {
    long startTime = System.currentTimeMillis();
    if(Const.DEVELOPER_MODE && Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        TrafficStats.setThreadStatsTag(0xF00D);
        try {
            HttpResponse res = super.performRequest(request, additionalHeaders);
            App.getInstance().getTracker().sendTiming("net",System.currentTimeMillis()-startTime, "volley", null);
            return res;
        } finally {
            TrafficStats.clearThreadStatsTag();
        }
    } else {
        HttpResponse response = super.performRequest(request, additionalHeaders);
        App.getInstance().getTracker().sendTiming("net",System.currentTimeMillis()-startTime, "gapi", null);
        return response;
    }
}
 
開發者ID:gdgjodhpur,項目名稱:gdgapp,代碼行數:19,代碼來源:OkStack.java

示例2: getFollowers

import android.net.TrafficStats; //導入方法依賴的package包/類
private void getFollowers() {

        if (BuildConfig.NETWORK_TEST && Build.VERSION.SDK_INT >= 14) {
            try {
                TrafficStats.setThreadStatsTag(APP_INITIATED_REQUEST);
                // Once tag has been applied, network request has to be made request
            } finally {
                TrafficStats.clearThreadStatsTag();
            }
        }

        RetroInterface.getZomatoRestApi().getUserFollowers(
                SessionPreference.getUserId(context) + "",
                user_id + "",
                new Callback<UserListResponse>() {
                    @Override
                    public void success(UserListResponse userListResponse, Response response) {
                        if(userListResponse!=null){
                            list = userListResponse.getUsers();
                            recyclerViewAdapter.refresh(list);
                        }
                    }

                    @Override
                    public void failure(RetrofitError error) {

                    }
                }
        );

    }
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:32,代碼來源:FollowerFragment.java

示例3: getFollowing

import android.net.TrafficStats; //導入方法依賴的package包/類
private void getFollowing() {

        if (BuildConfig.NETWORK_TEST && Build.VERSION.SDK_INT >= 14) {
            try {
                TrafficStats.setThreadStatsTag(APP_INITIATED_REQUEST);
                // Once tag has been applied, network request has to be made request
            } finally {
                TrafficStats.clearThreadStatsTag();
            }
        }

        RetroInterface.getZomatoRestApi().getUserFollowing(
                SessionPreference.getUserId(context) + "",
                user_id + "",
                new Callback<UserListResponse>() {
                    @Override
                    public void success(UserListResponse userListResponse, Response response) {
                        if (userListResponse != null) {
                            list = userListResponse.getUsers();
                            recyclerViewAdapter.refresh(list);
                        }
                    }

                    @Override
                    public void failure(RetrofitError error) {

                    }
                }
        );
    }
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:31,代碼來源:FollowingFragment.java

示例4: followUser

import android.net.TrafficStats; //導入方法依賴的package包/類
private void followUser(int pos, boolean isFollowing) {

        if (BuildConfig.NETWORK_TEST && Build.VERSION.SDK_INT >= 14) {
            try {
                TrafficStats.setThreadStatsTag(USER_INITIATED_REQUEST);
                // Once tag has been applied, network request has to be made request
            } finally {
                TrafficStats.clearThreadStatsTag();
            }
        }

        User user = mList.get(pos);
        RetroInterface.getZomatoRestApi().followUser(
                SessionPreference.getUserId(context) + "",
                user.getId() + "",
                (isFollowing ? 1 : 0) + "",
                new Callback<NormalResponse>() {
                    @Override
                    public void success(NormalResponse userListResponse, Response response) {

                    }

                    @Override
                    public void failure(RetrofitError error) {

                    }
                }
        );
    }
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:30,代碼來源:FriendAdapter.java

示例5: getRecentlyViewed

import android.net.TrafficStats; //導入方法依賴的package包/類
private void getRecentlyViewed() {

        if (BuildConfig.NETWORK_TEST && Build.VERSION.SDK_INT >= 14) {
            try {
                TrafficStats.setThreadStatsTag(APP_INITIATED_REQUEST);
                // Once tag has been applied, network request has to be made request
            } finally {
                TrafficStats.clearThreadStatsTag();
            }
        }

        UserLocation location = LocationPreference.getUserLocation(context);

        RetroInterface.getZomatoRestApi().getRecentRestaurants(
                SessionPreference.getUserId(context) + "",
                location.getLatitude() + "",
                location.getLongitude() + "",
                new Callback<RestaurantResponse>() {
                    @Override
                    public void success(RestaurantResponse restaurantResponse, Response response) {
                        if (restaurantResponse != null && restaurantResponse.isSuccess()) {
                            allList = restaurantResponse.getItems();
                            allAdapter.refresh(allList);
                        }
                    }

                    @Override
                    public void failure(RetrofitError error) {

                    }
                });

    }
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:34,代碼來源:RecentPlaceActivity.java

示例6: goSocialLogin

import android.net.TrafficStats; //導入方法依賴的package包/類
private void goSocialLogin(User user) {

        if (BuildConfig.NETWORK_TEST && Build.VERSION.SDK_INT >= 14) {
            try {
                TrafficStats.setThreadStatsTag(USER_INITIATED_REQUEST);
                // Once tag has been applied, network request has to be made request
            } finally {
                TrafficStats.clearThreadStatsTag();
            }
        }


        RetroInterface.getZomatoRestApi().loginSocial(
                CommonFunctions.getHashMap(user),
                new Callback<UserResponse>() {
                    @Override
                    public void success(UserResponse userResponse, Response response) {

                        if (userResponse != null && userResponse.isSuccess()) {

                            if (userResponse.getUser() != null) {
                                loginSuccess(userResponse.getUser());
                            }
                        }

                    }

                    @Override
                    public void failure(RetrofitError error) {

                    }
                }
        );

    }
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:36,代碼來源:SignInBaseActivity.java

示例7: goNormalLogin

import android.net.TrafficStats; //導入方法依賴的package包/類
private void goNormalLogin(User user) {

        if (BuildConfig.NETWORK_TEST && Build.VERSION.SDK_INT >= 14) {
            try {
                TrafficStats.setThreadStatsTag(USER_INITIATED_REQUEST);
                // Once tag has been applied, network request has to be made request
            } finally {
                TrafficStats.clearThreadStatsTag();
            }
        }

        RetroInterface.getZomatoRestApi().loginNormal(
                CommonFunctions.getHashMap(user),
                new Callback<UserResponse>() {
                    @Override
                    public void success(UserResponse userResponse, Response response) {

                        if (userResponse != null && userResponse.isSuccess()) {

                            if (userResponse.getUser() != null) {
                                loginSuccess(userResponse.getUser());
                            }
                        }

                    }

                    @Override
                    public void failure(RetrofitError error) {

                    }
                }
        );
    }
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:34,代碼來源:SignInBaseActivity.java

示例8: goNormalRegister

import android.net.TrafficStats; //導入方法依賴的package包/類
private void goNormalRegister(User user) {

        if (BuildConfig.NETWORK_TEST && Build.VERSION.SDK_INT >= 14) {
            try {
                TrafficStats.setThreadStatsTag(USER_INITIATED_REQUEST);
                // Once tag has been applied, network request has to be made request
            } finally {
                TrafficStats.clearThreadStatsTag();
            }
        }

        RetroInterface.getZomatoRestApi().registerNormal(
                CommonFunctions.getHashMap(user),
                new Callback<UserResponse>() {
                    @Override
                    public void success(UserResponse userResponse, Response response) {

                        if (userResponse != null && userResponse.isSuccess()) {

                            if (userResponse.getUser() != null) {
                                loginSuccess(userResponse.getUser());
                            }
                        }

                    }

                    @Override
                    public void failure(RetrofitError error) {

                    }
                }
        );

    }
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:35,代碼來源:SignInBaseActivity.java

示例9: followUser

import android.net.TrafficStats; //導入方法依賴的package包/類
private void followUser(int pos, boolean isFollowing) {

        if (BuildConfig.NETWORK_TEST && Build.VERSION.SDK_INT >= 14) {
            try {
                TrafficStats.setThreadStatsTag(USER_INITIATED_REQUEST);
                // Once tag has been applied, network request has to be made request
            } finally {
                TrafficStats.clearThreadStatsTag();
            }
        }

        User user = allList.get(pos);
        RetroInterface.getZomatoRestApi().followUser(
                SessionPreference.getUserId(context) + "",
                user.getId() + "",
                (isFollowing ? 1 : 0) + "",
                new Callback<NormalResponse>() {
                    @Override
                    public void success(NormalResponse userListResponse, Response response) {

                    }

                    @Override
                    public void failure(RetrofitError error) {

                    }
                }
        );
    }
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:30,代碼來源:FindFriendActivity.java

示例10: setList

import android.net.TrafficStats; //導入方法依賴的package包/類
private void setList() {

        if (BuildConfig.NETWORK_TEST && Build.VERSION.SDK_INT >= 14) {
            try {
                TrafficStats.setThreadStatsTag(APP_INITIATED_REQUEST);
                // Once tag has been applied, network request has to be made request
            } finally {
                TrafficStats.clearThreadStatsTag();
            }
        }

        RetroInterface.getZomatoRestApi().getUserSuggestion(
                SessionPreference.getUserId(context) + "",
                new Callback<UserListResponse>() {
                    @Override
                    public void success(UserListResponse userListResponse, Response response) {

                        if (userListResponse != null) {

                            allList = userListResponse.getUsers();
                            allAdapter.refresh(allList);
                        }

                    }

                    @Override
                    public void failure(RetrofitError error) {

                    }
                }
        );


    }
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:35,代碼來源:FindFriendActivity.java

示例11: getPopularLocations

import android.net.TrafficStats; //導入方法依賴的package包/類
private void getPopularLocations() {

        if (BuildConfig.NETWORK_TEST && Build.VERSION.SDK_INT >= 14) {
            try {
                TrafficStats.setThreadStatsTag(APP_INITIATED_REQUEST);
                // Once tag has been applied, network request has to be made request
            } finally {
                TrafficStats.clearThreadStatsTag();
            }
        }

        RetroInterface.getZomatoRestApi().getPopularLocation(
                "",
                new Callback<UserLocationResponse>() {
                    @Override
                    public void success(UserLocationResponse userLocationResponse, Response response) {
                        locationItems = userLocationResponse.getUserLocations();
                        popularAdapter.refresh(locationItems);
                    }

                    @Override
                    public void failure(RetrofitError error) {

                    }
                }
        );

    }
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:29,代碼來源:SelectLocationActivity.java

示例12: getRestaurants

import android.net.TrafficStats; //導入方法依賴的package包/類
private void getRestaurants() {

        if (BuildConfig.NETWORK_TEST && Build.VERSION.SDK_INT >= 14) {
            try {
                TrafficStats.setThreadStatsTag(APP_INITIATED_REQUEST);
                // Once tag has been applied, network request has to be made request
            } finally {
                TrafficStats.clearThreadStatsTag();
            }
        }

        UserLocation location =
                LocationPreference.getUserLocation(context);
        RetroInterface.getZomatoRestApi().getRecommendedRestaurants(
                SessionPreference.getUserId(context)+"",
                location.getLatitude() + "",
                location.getLongitude() + "",
                new Callback<RestaurantResponse>() {
                    @Override
                    public void success(RestaurantResponse restaurantResponse, Response response) {

                        if (restaurantResponse != null && restaurantResponse.isSuccess()) {
                            mightList = restaurantResponse.getItems();
                            mightAdapter.refresh(mightList);
                        }
                    }

                    @Override
                    public void failure(RetrofitError error) {

                    }
                }
        );
    }
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:35,代碼來源:BrowseNearbyActivity.java

示例13: getRestaurantList

import android.net.TrafficStats; //導入方法依賴的package包/類
private void getRestaurantList() {
    if (BuildConfig.NETWORK_TEST && Build.VERSION.SDK_INT >= 14) {
        try {
            TrafficStats.setThreadStatsTag(APP_INITIATED_REQUEST);
            // Once tag has been applied, network request has to be made request
        } finally {
            TrafficStats.clearThreadStatsTag();
        }
    }

    UserLocation location = LocationPreference.getUserLocation(context);

    RetroInterface.getZomatoRestApi().getAllRestaurants(
            SessionPreference.getUserId(context) + "",
            location.getLatitude() + "",
            location.getLongitude() + "",
            new Callback<RestaurantResponse>() {
                @Override
                public void success(RestaurantResponse restaurantResponse, Response response) {

                    if (restaurantResponse != null && restaurantResponse.isSuccess()) {
                        allList = restaurantResponse.getItems();
                        //allAdapter.refresh(allList);

                        refreshList();
                    }

                }

                @Override
                public void failure(RetrofitError error) {

                }
            }

    );

}
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:39,代碼來源:AddPlaceToCollectionActivity.java

示例14: getCollectionRestaurants

import android.net.TrafficStats; //導入方法依賴的package包/類
private void getCollectionRestaurants() {

        if (BuildConfig.NETWORK_TEST && Build.VERSION.SDK_INT >= 14) {
            try {
                TrafficStats.setThreadStatsTag(APP_INITIATED_REQUEST);
                // Once tag has been applied, network request has to be made request
            } finally {
                TrafficStats.clearThreadStatsTag();
            }
        }

        UserLocation location = LocationPreference.getUserLocation(context);
        RetroInterface.getZomatoRestApi().getCollectionRestaurants(
                SessionPreference.getUserId(context)+"",
                item.getId() + "",
                location.getLatitude() + "",
                location.getLongitude() + "",
                new Callback<RestaurantResponse>() {
                    @Override
                    public void success(RestaurantResponse restaurantResponse, Response response) {

                        if (restaurantResponse != null && restaurantResponse.isSuccess()) {
                            mightList = restaurantResponse.getItems();
                            mightAdapter.refresh(mightList);
                            saves.setText(getString(R.string.txt_place_n_save, mightList.size(), item.getCount()));
                        }

                    }

                    @Override
                    public void failure(RetrofitError error) {

                    }
                }
        );

    }
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:38,代碼來源:CollectionDetailActivity.java

示例15: getRestaurantDetails

import android.net.TrafficStats; //導入方法依賴的package包/類
private void getRestaurantDetails() {

        if (BuildConfig.NETWORK_TEST && Build.VERSION.SDK_INT >= 14) {
            try {
                TrafficStats.setThreadStatsTag(APP_INITIATED_REQUEST);
                // Once tag has been applied, network request has to be made request
            } finally {
                TrafficStats.clearThreadStatsTag();
            }
        }

        RetroInterface.getZomatoRestApi().getRestaurantDetails(
                SessionPreference.getUserId(context) + "",
                restaurantItem.getId() + "",
                new Callback<RestaurantDetailResponse>() {
                    @Override
                    public void success(RestaurantDetailResponse restaurantResponse, Response response) {

                        RestaurantDetails details = restaurantResponse.getDetails();
                        List<RestaurantImage> images = details.getImages();
                        List<RestaurantTiming> timings = details.getTimings();
                        List<RestaurantImage> photos = details.getPhoto();
                        List<RestaurantMenu> menu = details.getMenu();
                        reviewItems = details.getReviews();

                        setPagerImages(images);
                        setTimings(timings);
                        setReviews();
                        updatePhotos(photos);
                        updateMenus(menu);

                        setMoreDetails(details.getReviewDetail(), details.getBookmark(), details.getBeenThere());

                    }

                    @Override
                    public void failure(RetrofitError error) {

                    }
                }
        );
    }
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:43,代碼來源:PlaceDetailActivity.java


注:本文中的android.net.TrafficStats.clearThreadStatsTag方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。