Example usage for android.os Bundle getSerializable

List of usage examples for android.os Bundle getSerializable

Introduction

In this page you can find the example usage for android.os Bundle getSerializable.

Prototype

@Override
@Nullable
public Serializable getSerializable(@Nullable String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:com.github.michalbednarski.intentslab.editor.IntentEditorActivity.java

private void startActivityRemote(IRemoteInterface remoteInterface, boolean forResult) throws Throwable {
    Bundle result = remoteInterface
            .startActivity(mEditedIntent,
                    ((mEditedIntent.getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK) != 0 && !forResult) ? null
                            : getTokenForRemoteInterface(),
                    forResult ? REQUEST_CODE_TEST_STARTACTIVITYFORRESULT : -1);
    Throwable exception = (Throwable) result.getSerializable("exception");
    if (exception != null) {
        throw exception;
    }// w w  w . j  a  va2 s . c  o m
}

From source file:com.quuzz.tbg.recyclerview.RecyclerViewFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.recycler_view_frag, container, false);
    rootView.setTag(TAG);/*w  w  w  . j  a  v  a2 s  .  c  om*/

    // BEGIN_INCLUDE(initializeRecyclerView)
    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerView);

    // LinearLayoutManager is used here, this will layout the elements in a similar fashion
    // to the way ListView would layout elements. The RecyclerView.LayoutManager defines how
    // elements are laid out.
    mLayoutManager = new LinearLayoutManager(getActivity());

    mCurrentLayoutManagerType = LayoutManagerType.GRID_LAYOUT_MANAGER;

    if (savedInstanceState != null) {
        // Restore saved layout manager type.
        mCurrentLayoutManagerType = (LayoutManagerType) savedInstanceState.getSerializable(KEY_LAYOUT_MANAGER);
    }
    setRecyclerViewLayoutManager(mCurrentLayoutManagerType);

    mAdapter = new CustomAdapter(getActivity());
    mRecyclerView.setAdapter(mAdapter);

    //        mLinearLayoutRadioButton = (RadioButton) rootView.findViewById(R.id.linear_layout_rb);
    //        mLinearLayoutRadioButton.setOnClickListener(new View.OnClickListener() {
    //            @Override
    //            public void onClick(View v) {
    //                setRecyclerViewLayoutManager(LayoutManagerType.LINEAR_LAYOUT_MANAGER);
    //            }
    //        });
    //
    //        mGridLayoutRadioButton = (RadioButton) rootView.findViewById(R.id.grid_layout_rb);
    //        mGridLayoutRadioButton.setOnClickListener(new View.OnClickListener() {
    //            @Override
    //            public void onClick(View v) {
    //                setRecyclerViewLayoutManager(LayoutManagerType.GRID_LAYOUT_MANAGER);
    //            }
    //        });
    return rootView;
}

From source file:de.mprengemann.hwr.timetabel.TimetableActivity.java

@Override
@Deprecated//from   w w w. ja v  a2s .  c o m
protected Dialog onCreateDialog(int id, Bundle b) {
    AlertDialog.Builder builder;

    switch (id) {
    case ERROR_DIALOG:
        builder = new AlertDialog.Builder(this);
        TimetableErrorType errorType = TimetableErrorType.GENERAL;

        if (b != null) {
            builder.setMessage(b.getString(KEY_DIALOG_ERROR_MSG));
            errorType = (TimetableErrorType) b.getSerializable(KEY_DIALOG_ERROR_TYPE);
        } else {
            builder.setMessage(R.string.dialog_error_message);
        }

        builder.setTitle(R.string.dialog_error_title);
        builder.setCancelable(false);
        if (errorType == TimetableErrorType.FORMAT) {
            builder.setNeutralButton(android.R.string.ok, new OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    refreshItem.setVisible(true);
                    getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
                    subjectFragment.setInitalState();
                    setSupportProgressBarIndeterminateVisibility(false);

                    removeDialog(ERROR_DIALOG);
                }

            });
        } else if (errorType == TimetableErrorType.UNKNOWN_TIMETABLE
                || errorType == TimetableErrorType.AUTHENTIFICATON) {
            builder.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    refreshItem.setVisible(true);
                    getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
                    subjectFragment.setInitalState();
                    setSupportProgressBarIndeterminateVisibility(false);

                    removeDialog(ERROR_DIALOG);

                    Intent i = new Intent(TimetableActivity.this, PreferenceActivity_.class);
                    startActivityForResult(i, PREFERENCE_REQUEST);
                }
            });
            builder.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    refreshItem.setVisible(true);
                    getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
                    subjectFragment.setInitalState();
                    setSupportProgressBarIndeterminateVisibility(false);

                    removeDialog(ERROR_DIALOG);
                }
            });
        } else {
            builder.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    Parser parser = new Parser(TimetableActivity.this, resultPassedListener);
                    parser.execute();

                    removeDialog(ERROR_DIALOG);
                }
            });
            builder.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    refreshItem.setVisible(true);
                    getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
                    subjectFragment.setInitalState();
                    setSupportProgressBarIndeterminateVisibility(false);

                    removeDialog(ERROR_DIALOG);
                }
            });
        }

        return builder.create();
    default:
        return super.onCreateDialog(id, b);
    }
}

From source file:com.prasanna.android.stacknetwork.QuestionActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    super.onCreate(savedInstanceState);

    setContentView(R.layout.viewpager_title_indicator);

    resultReceiver = new RestQueryResultReceiver(new Handler());
    resultReceiver.setReceiver(this);

    if (questionFragment == null)
        questionFragment = QuestionFragment.newFragment();

    setupViewPager();//from ww  w .ja v a2 s  . c  o  m

    if (savedInstanceState != null && savedInstanceState.getSerializable(StringConstants.QUESTION) != null)
        question = (Question) savedInstanceState.getSerializable(StringConstants.QUESTION);
    else
        prepareIntentAndStartService();
}

From source file:edu.iit.cs442.team7.iitbazaar.fragments.RecyclerViewCategoryListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.recycler_view_list_frag, container, false);
    rootView.setTag(TAG);/*from   ww w.  j av  a 2  s .c om*/

    // BEGIN_INCLUDE(initializeRecyclerView)
    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerView);

    // LinearLayoutManager is used here, this will layout the elements in a similar fashion
    // to the way ListView would layout elements. The RecyclerView.LayoutManager defines how
    // elements are laid out.
    mLayoutManager = new LinearLayoutManager(getActivity());

    mCurrentLayoutManagerType = LayoutManagerType.LINEAR_LAYOUT_MANAGER;

    if (savedInstanceState != null) {
        // Restore saved layout manager type.
        mCurrentLayoutManagerType = (LayoutManagerType) savedInstanceState.getSerializable(KEY_LAYOUT_MANAGER);
    }
    setRecyclerViewLayoutManager(mCurrentLayoutManagerType);

    mDataset = IITBazaar.getDBController().getAllCategories();
    //mCursor.moveToFirst();

    mAdapter = new CategoryAdapter(parentActivity, mDataset);
    // Set ItemAdapter as the adapter for RecyclerView.
    mRecyclerView.setAdapter(mAdapter);

    //DBController controller = IITBazaar.getDBController();
    //parentActivity.registerDataChangeListeners(mAdapter);
    // END_INCLUDE(initializeRecyclerView)
    /*String [] categoryItem = new String[DATASET_COUNT];
    categoryItem[0] = "Art";
    categoryItem[1] = "Books";
    categoryItem[2] = "Consumer Electronics";
    categoryItem[3] = "Cell Phones and Accessories";
    categoryItem[4] = "Clothing Shoes and Accessories";
    categoryItem[5] = "DVDs and Movies";
    categoryItem[6] = "Giftcards and Coupons";
    categoryItem[7] = "Musical Instruments";
    categoryItem[8] = "Sporting Goods";
    categoryItem[9] = "Video Games and Consoles";*/
    initDataset(controller);
    int count = mDataset.size();
    for (int i = 0; i < count; i++) {
        mAdapter.addCategory(i, mDataset.get(i));
    }
    return rootView;
}

From source file:experiment.com.example.anurag.hackinthenorth.RecyclerViewFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.recycler_view_frag, container, false);
    rootView.setTag(TAG);//from w ww .  ja  v a 2s.c  o m

    // BEGIN_INCLUDE(initializeRecyclerView)
    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerView);

    // LinearLayoutManager is used here, this will layout the elements in a similar fashion
    // to the way ListView would layout elements. The RecyclerView.LayoutManager defines how
    // elements are laid out.
    mLayoutManager = new LinearLayoutManager(getActivity());

    mCurrentLayoutManagerType = LayoutManagerType.LINEAR_LAYOUT_MANAGER;

    if (savedInstanceState != null) {
        // Restore saved layout manager type.
        mCurrentLayoutManagerType = (LayoutManagerType) savedInstanceState.getSerializable(KEY_LAYOUT_MANAGER);
    }
    setRecyclerViewLayoutManager(mCurrentLayoutManagerType);

    mAdapter = new CustomAdapter(personList);
    // Set CustomAdapter as the adapter for RecyclerView.
    mRecyclerView.setAdapter(mAdapter);
    // END_INCLUDE(initializeRecyclerView)

    return rootView;
}

From source file:jp.maju.wifiserver.client.ClientActivity.java

@SuppressLint("SetJavaScriptEnabled")
@Override/*from  w ww . j  a  v a  2  s .  com*/
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (savedInstanceState == null) {
        if (getIntent() == null) {
            finish();
            return;
        }

        Serializable s = getIntent().getSerializableExtra(KEY_SOCKET_INFO);

        if (s == null || !(s instanceof SocketInfo)) {
            finish();
            return;
        }

        mSocketInfo = (SocketInfo) s;
    } else {
        mSocketInfo = (SocketInfo) savedInstanceState.getSerializable(KEY_SOCKET_INFO);
    }

    //        PreferenceUtil.setAnchor(getApplication(), mSocketInfo.getKind());

    CommonUtil.stopService(this, ClientService.class);

    setContentView(R.layout.activity_client);

    mWebView = (CustomWebView) findViewById(R.id.wv_client_content);
    mWebView.setOnClickLinkListener(this);

    mClientObserver = new ConnectionObserver();
    mClientObserver.setOnStateListener(this);

    mMessageHandler = new MessageHandler(this);

    registerReceiver(mClientObserver, CommonUtil.getNewIntentFilterWillBeRecieved());

    if (mSocketInfo != null) {
        Logger.d(TAG, mSocketInfo.toString());

        doConnect2Server();
    } else {
        finish();
    }
}

From source file:com.fa.mastodon.activity.AccountActivity.java

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_account);
    ButterKnife.bind(this);

    if (savedInstanceState != null) {
        accountId = savedInstanceState.getString("accountId");
        followState = (FollowState) savedInstanceState.getSerializable("followState");
        blocking = savedInstanceState.getBoolean("blocking");
        muting = savedInstanceState.getBoolean("muting");
    } else {//from ww  w  .j a v  a2  s .  c  o m
        Intent intent = getIntent();
        accountId = intent.getStringExtra("id");
        followState = FollowState.NOT_FOLLOWING;
        blocking = false;
        muting = false;
    }
    loadedAccount = null;

    SharedPreferences preferences = getPrivatePreferences();
    String loggedInAccountId = preferences.getString("loggedInAccountId", null);

    // Setup the toolbar.
    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setTitle(null);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
    }

    // Add a listener to change the toolbar icon color when it enters/exits its collapsed state.
    AppBarLayout appBarLayout = (AppBarLayout) findViewById(R.id.account_app_bar_layout);
    final CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout) findViewById(
            R.id.collapsing_toolbar);
    appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
        @AttrRes
        int priorAttribute = R.attr.account_toolbar_icon_tint_uncollapsed;

        @Override
        public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
            @AttrRes
            int attribute;
            if (collapsingToolbar.getHeight() + verticalOffset < 2
                    * ViewCompat.getMinimumHeight(collapsingToolbar)) {
                if (getSupportActionBar() != null && loadedAccount != null) {
                    getSupportActionBar().setTitle(loadedAccount.getDisplayName());
                    toolbar.setTitleTextColor(
                            ThemeUtils.getColor(AccountActivity.this, android.R.attr.textColorPrimary));

                    String subtitle = String.format(getString(R.string.status_username_format),
                            loadedAccount.username);
                    getSupportActionBar().setSubtitle(subtitle);
                    toolbar.setSubtitleTextColor(
                            ThemeUtils.getColor(AccountActivity.this, android.R.attr.textColorSecondary));
                }
                attribute = R.attr.account_toolbar_icon_tint_collapsed;
            } else {
                if (getSupportActionBar() != null) {
                    getSupportActionBar().setTitle("");
                    getSupportActionBar().setSubtitle("");
                }
                attribute = R.attr.account_toolbar_icon_tint_uncollapsed;
            }
            if (attribute != priorAttribute) {
                priorAttribute = attribute;
                Context context = toolbar.getContext();
                ThemeUtils.setDrawableTint(context, toolbar.getNavigationIcon(), attribute);
                ThemeUtils.setDrawableTint(context, toolbar.getOverflowIcon(), attribute);
            }
        }
    });

    // Initialise the default UI states.
    floatingBtn.hide();

    // Obtain information to fill out the profile.
    obtainAccount();
    if (!accountId.equals(loggedInAccountId)) {
        isSelf = false;
        obtainRelationships();
    } else {
        /* Cause the options menu to update and instead show an options menu for when the
         * account being shown is their own account. */
        isSelf = true;
        invalidateOptionsMenu();
    }

    // Setup the tabs and timeline pager.
    AccountPagerAdapter adapter = new AccountPagerAdapter(getSupportFragmentManager(), this, accountId);
    pagerAdapter = adapter;
    String[] pageTitles = { getString(R.string.title_statuses), getString(R.string.title_follows),
            getString(R.string.title_followers) };
    adapter.setPageTitles(pageTitles);
    ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
    int pageMargin = getResources().getDimensionPixelSize(R.dimen.tab_page_margin);
    viewPager.setPageMargin(pageMargin);
    Drawable pageMarginDrawable = ThemeUtils.getDrawable(this, R.attr.tab_page_margin_drawable,
            R.drawable.tab_page_margin_dark);
    viewPager.setPageMarginDrawable(pageMarginDrawable);
    viewPager.setAdapter(adapter);
    tabLayout.setupWithViewPager(viewPager);
    for (int i = 0; i < tabLayout.getTabCount(); i++) {
        TabLayout.Tab tab = tabLayout.getTabAt(i);
        if (tab != null) {
            tab.setCustomView(adapter.getTabView(i, tabLayout));
        }
    }
}

From source file:com.myapps.upesse.upes_spefest.ui.activity.PostsFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
    linearLayoutManager.setReverseLayout(true);
    linearLayoutManager.setStackFromEnd(true);
    mRecyclerView.setLayoutManager(linearLayoutManager);

    if (savedInstanceState != null) {
        // Restore saved layout manager type.
        mRecyclerViewPosition = (int) savedInstanceState.getSerializable(KEY_LAYOUT_POSITION);
        mRecyclerView.scrollToPosition(mRecyclerViewPosition);
        // TODO: RecyclerView only restores position properly for some tabs.
    }/*from w w w. ja  va 2 s.c o m*/

    switch (getArguments().getInt(KEY_TYPE)) {
    case TYPE_FEED:
        Log.d(TAG, "Restoring recycler view position (all): " + mRecyclerViewPosition);

        //if(homeFeed.getVisibility()==View.VISIBLE)
        //  homeFeed.setVisibility(View.GONE);

        Query allPostsQuery = FirebaseUtil.getPostsRef();

        mAdapter = getFirebaseRecyclerAdapter(allPostsQuery);

        mAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
            @Override
            public void onItemRangeInserted(int positionStart, int itemCount) {
                super.onItemRangeInserted(positionStart, itemCount);
                if (itemCount == 1) {
                    if (dialog != null) {
                        if (dialog.isShowing())
                            dialog.hide();
                    }
                }
                // TODO: Refresh feed view.
            }
        });

        mRecyclerView.setAdapter(mAdapter);
        break;
    case TYPE_HOME:
        Log.d(TAG, "Restoring recycler view position (following): " + mRecyclerViewPosition);

        FirebaseUtil.getCurrentUserRef().child("following").addChildEventListener(new ChildEventListener() {
            @Override
            public void onChildAdded(final DataSnapshot followedUserSnapshot, String s) {

                //setToast(false);

                String followedUserId = followedUserSnapshot.getKey();
                String lastKey = "";
                if (followedUserSnapshot.getValue() instanceof String) {
                    lastKey = followedUserSnapshot.getValue().toString();
                }
                Log.d(TAG, "followed user id: " + followedUserId);
                Log.d(TAG, "last key: " + lastKey);
                FirebaseUtil.getPeopleRef().child(followedUserId).child("posts").orderByKey().startAt(lastKey)
                        .addChildEventListener(new ChildEventListener() {
                            @Override
                            public void onChildAdded(final DataSnapshot postSnapshot, String s) {
                                HashMap<String, Object> addedPost = new HashMap<String, Object>();
                                addedPost.put(postSnapshot.getKey(), true);
                                FirebaseUtil.getFeedRef().child(FirebaseUtil.getCurrentUserId())
                                        .updateChildren(addedPost)
                                        .addOnSuccessListener(new OnSuccessListener<Void>() {
                                            @Override
                                            public void onSuccess(Void aVoid) {
                                                FirebaseUtil.getCurrentUserRef().child("following")
                                                        .child(followedUserSnapshot.getKey())
                                                        .setValue(postSnapshot.getKey());
                                            }
                                        });
                            }

                            @Override
                            public void onChildChanged(DataSnapshot dataSnapshot, String s) {

                            }

                            @Override
                            public void onChildRemoved(DataSnapshot dataSnapshot) {

                            }

                            @Override
                            public void onChildMoved(DataSnapshot dataSnapshot, String s) {

                            }

                            @Override
                            public void onCancelled(DatabaseError databaseError) {

                            }
                        });
            }

            @Override
            public void onChildChanged(DataSnapshot dataSnapshot, String s) {

            }

            @Override
            public void onChildRemoved(DataSnapshot dataSnapshot) {

            }

            @Override
            public void onChildMoved(DataSnapshot dataSnapshot, String s) {

            }

            @Override
            public void onCancelled(DatabaseError databaseError) {

            }
        });

        FirebaseUtil.getFeedRef().child(FirebaseUtil.getCurrentUserId())
                .addListenerForSingleValueEvent(new ValueEventListener() {
                    @Override
                    public void onDataChange(DataSnapshot dataSnapshot) {
                        final List<String> postPaths = new ArrayList<>();
                        for (DataSnapshot snapshot : dataSnapshot.getChildren()) {
                            Log.d(TAG, "adding post key: " + snapshot.getKey());
                            postPaths.add(snapshot.getKey());
                        }
                        mAdapter = new FirebasePostQueryAdapter(postPaths,
                                new FirebasePostQueryAdapter.OnSetupViewListener() {
                                    @Override
                                    public void onSetupView(PostViewHolder holder, Post post, int position,
                                            String postKey) {
                                        if (post != null) {
                                            setupPost(holder, post, position, postKey);
                                        }
                                    }
                                });
                        mRecyclerView.setAdapter(mAdapter);

                    }

                    @Override
                    public void onCancelled(DatabaseError firebaseError) {

                    }
                });
        break;
    default:
        throw new RuntimeException("Illegal post fragment type specified.");
    }

    mRecyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            FeedContextMenuManager.getInstance().onScrolled(recyclerView, dx, dy);
        }
    });
    //mRecyclerView.setAdapter(mAdapter);
}

From source file:com.nbplus.vbroadlauncher.RadioActivity.java

public void handleMessage(Message msg) {
    if (msg == null) {
        return;//from  w w  w  .j  a  v a 2  s.  com
    }
    switch (msg.what) {
    // ??  .
    case Constants.HANDLER_MESSAGE_GET_RADIO_CHANNEL_TASK:
        RadioChannelInfo data = (RadioChannelInfo) msg.obj;

        dismissProgressDialog();
        if (data != null && Constants.RESULT_OK.equals(data.getResultCode())) {
            mRadioChannelItems = data.getRadioChannelList();
            if (mRadioChannelItems == null) {
                mRadioChannelItems = new ArrayList<>();
            }
        } else {
            if (mRadioChannelItems == null) {
                mRadioChannelItems = new ArrayList<>();
            }

            if (data == null) {
                data = new RadioChannelInfo();
                data.setResultMessage(getString(R.string.server_connection_error));
            }

            Intent i = new Intent(this, MusicService.class);
            i.setAction(MusicService.ACTION_STOP);
            i.putExtra(MusicService.EXTRA_MUSIC_FORCE_STOP, true);
            startService(i);

            AlertDialog.Builder alert = new AlertDialog.Builder(this);
            alert.setPositiveButton(R.string.alert_ok, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                    //finish();
                }
            });
            alert.setMessage(data.getResultMessage());
            try {
                alert.show();
            } catch (Exception e) {

            }
        }
        mIsExecuteGetRadioChannelTask = false;
        getRadioChannelTask = null;

        setupRadioChannelPager();
        break;
    // ?? ?  . ? ??  
    case Constants.HANDLER_MESSAGE_PLAY_RADIO_CHANNEL_TIMEOUT:
        Intent i = new Intent(this, MusicService.class);
        i.setAction(MusicService.ACTION_STOP);
        i.putExtra(MusicService.EXTRA_MUSIC_FORCE_STOP, true);
        startService(i);
        break;

    //   
    case HANDLER_MESSAGE_STREAM_MUSIC_VOLUME_CHANGE:
        int currentVolume = msg.arg1;
        if (currentVolume <= 0) {
            mSoundToggle.setBackgroundResource(R.drawable.ic_button_radio_sound_off);
        } else {
            mSoundToggle.setBackgroundResource(R.drawable.ic_button_radio_sound_on);
        }
        mSeekbar.setProgress(currentVolume);
        break;

    // ?
    case HANDLER_MESSAGE_MUSIC_SERVICE_ACTION:
        Bundle b = msg.getData();
        if (b == null) {
            Log.i(TAG, "HANDLER_MESSAGE_MUSIC_SERVICE_ACTION bundle is not found!!");
            return;
        }
        String action = b.getString(MusicService.EXTRA_ACTION);
        MusicService.State state = (MusicService.State) b.getSerializable(MusicService.EXTRA_PLAYING_STATUS);
        MusicRetriever.Item item = b.getParcelable(MusicService.EXTRA_MUSIC_ITEM);

        if (state == MusicService.State.Playing) {
            mPlayToggle.setBackgroundResource(R.drawable.ic_btn_radio_pause_selector);
            mRadioTitle.setText(item.getTitle());
        } else if (state == MusicService.State.Paused) {
            mPlayToggle.setBackgroundResource(R.drawable.ic_btn_radio_play_selector);
            mRadioTitle.setText(item.getTitle());
        } else if (state == MusicService.State.Stopped) {
            mPlayToggle.setBackgroundResource(R.drawable.ic_btn_radio_play_selector);
            b.remove(MusicService.EXTRA_MUSIC_ITEM);
            mRadioTitle.setText(R.string.activity_radio_default_title);
        } else {
            mRadioTitle.setText(R.string.activity_radio_default_title);
        }
        mCurrentPlayingStatus = b;
        for (int idx = 0; idx < mActivityInteractionListener.size(); idx++) {
            mActivityInteractionListener.get(idx).onPlayItemChanged(b);
        }

        if (!mIsExecuteGetRadioChannelTask) {
            mHandler.sendEmptyMessageDelayed(HANDLER_MESSAGE_HIDE_PROGRESS_DIALOG, 1500);
        }
        break;

    //  
    case HANDLER_MESSAGE_HIDE_PROGRESS_DIALOG:
        dismissProgressDialog();
        break;
    }
}