• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps clear cache in android youtubeplayersupportfragment video

krishnaveni

Well-Known Member
Dec 16, 2011
158
0
chennai
have to develop an one android application.

i have to play the video using youtubeplayerfragment.

Here the video is playing well on fullscreen mode. The Same video is playing well on normal mode also.Here am facing one problem.

The problem is,

More number of video is available in Gallery view.

Here if i have to click one video from gallery view means that video is playing well.Now i have to stop that video and click next video means the next video audio is hearing .but the last playing video(at stopping place) thumbnail image is displaying.but its working fullscreen mode correctly.

How can i clear my cache memory here ??? is there any specific algorithm for this?please give me solution ???


[HIGH]FragmentManager fragmentManager = getChildFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager
.beginTransaction();
YouTubePlayerSupportFragment fragment = new YouTubePlayerSupportFragment();
fragmentTransaction.add(R.id.youtube_fragment, fragment);
fragmentTransaction.commit();


fragment.initialize(DeveloperKey.DEVELOPER_KEY, new OnInitializedListener() {

@Override
public void onInitializationSuccess(Provider arg0,
YouTubePlayer arg1, boolean arg2) {
if (!arg2) {
arg1.loadVideo(_Video);

}
}
@Override
public void onInitializationFailure(Provider provider,
YouTubeInitializationResult errorReason) {

Toast.makeText(getActivity(), "Please install the Youtube app on your device ", Toast.LENGTH_LONG).show();

}

});
[/HIGH]
I have using following xml:

[HIGH]
<fragment
android:name="com.google.android.youtube.player.YouTubePlayerSupportFragment"
android:id="@+id/youtube_fragment"
android:layout_width="match_parent"
android:layout_below="@+id/title"
android:layout_height="wrap_content"/>
[/HIGH]How can i clear cache in my android application.please give me some suggestions ..
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones