I'm having a problem with a WebView. It's purpose is to show the frame of a youTube video, then when you touch it, I handle the touch event myself and play a local video. The problem is that every now and then, when it goes to display the WebView, it immediately launches the device's browser and takes the user to the Youtube video. It feels like the WebView is blowing up from the frame and taking over the app.
I don't know why this is happening! Any help is appreciated.
mWebView.setVisibility(View.VISIBLE);
mWebView.setOnTouchListener(this);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setPluginsEnabled(true);
mWebView.getSettings().setSupportZoom(false);
mWebView.loadUrl("http://www.youtube.com/v/" + lesson.getYoutubeID());
The problem is that every now and then, when it goes to display the WebView, it immediately launches the device's browser and takes the user to the Youtube video.
That will occur if:
http://www.youtube.com/v/" + lesson.getYoutubeID() results in an HTTP redirect, and
You do not handle that redirect via a WebViewClient and shouldOverrideUrlLoading()
Related
I am using jitsi-android-sdk in which when I go click home screen it takes me to the picture in picture mode and when I click on the app takes me back to the first form page. How should full screen the picture in picture mode when I click on the app?
what should I put in onResume() so I can full-screen picture in picture on click of the app.
For example, When we are using Netflix and watching a movie on mobile when we press the home button it enters the picture in picture mode and when we click on the app icon it fullscreen the picture in picture mode (return to the movie in fullscreen which we are watching)
I want to implement the same behavior in my android app.
The first check which activity is going to paused state when the app goes picture in picture on that activity onResume() method add this code.
#Override
protected void onResume() {
super.onResume();
SharedPreferences sharedpreferences = getSharedPreferences("MyPrefs", Context.MODE_PRIVATE);
//get boolean value from shared preferences which we are store when joining meeting button is clicked
boolean check = sharedpreferences.getBoolean(met,false);
if (check){
//if meeting is going on redirect to meeting
//Replace JitsiMeetAcitvity.class with your picture in picture activity class
startActivity(new Intent(this, JitsiMeetActivity.class)
.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT));
}
}
I have used the shared preferences to keep the track of the meeting is going on or not.
If you want to see in detail Follow this
I have an app to read the news, it is a simple WebView.
It can happen that on the web page there is a video, and if I open the video to a full screen there are two ways to exit the full-screen mode (It is not a YouTube video):
press the special button [exit full-screen mode] button - it works fine
press the back button - having many issues with it
The video is closed and WebView goes back to the previous page if I use this code. I do not like it because the web page scrolls up and down after I go back... server-side issues.
#Override
public void onBackPressed() {
if (webView.canGoBack()) {
webView.goBack();
} else {
super.onBackPressed();
}
}
Is there a simple way to detect the full-screen mode, and based on the retrieved info exit the full-screen mode or go back to the previous page?
Thank you,
Alex.
I have this sign in/register page. When you log in, it will go to membership page(fragment) and now I want to go back to the home page of the phone without logging out but whenever I click back built in button it goes to the past page activities.
I tried this android:noHistory="true" but when i click sign in but i didnt sign in, just backstack. the sign in/register page not appearing anymore.
If you would never like to navigate back to the login activity simply use the line of code
finish();
after your call to startAcitivty(). This will close the activity and won't be available to navigate back to without restarting the app or specifically calling the activity later in your code.
Or just Override onBackPressed() to finish.
Android system's default photo viewing app is used as the default viewer. It functions normally.
The code for photo viewing button is as follows:
//view source image
public void viewSourceClicked(View view){
Uri uri = getImageUri(this, MethodCommons.convertByteArrayToBitmap(itemToBeEdited.getOriginalImage()));
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(uri, "image/*");
startActivity(intent);
}
Except, when viewer's share button is pressed showing the share menu, if the user presses power button (closes the screen), then clicking this button after resuming the activity results only in a black screen.
Restarting the app containing the photo-viewing button does not resolve the issue.
This black screen can only be resolved by opening the default photo viewing app and click the share button once. So I figure that it relates to photo viewer's share activity being left open somehow.
How to prevent such black screen from occurring? any other suggestions?
Eventually I figured out that this resulted from using MediaStore.Images.Media.insertImage.
Using FileProvider in place of insertImage solved the problem.
The title is probably not the best but I will try to explain my problem.
I have a login/signup page where I can click on a facebook button to login through or I can click on a mail button.
When I click on this button, I open a new activity with a form to sign up. I want this activity to be transparent to a certain extent to see my first login/signup in the background page which is done. On this same page (sign up page), I have another button "I already have an account" that opens a new login activity.
This login activity is also transparent but the background is the sign up form and not my first page which is normal but I don't know how to get my first page as a background.
Any advice ?
Regards,
Arnaud
You just need to call finish()
Intent intent = new Intent(this, NextActivity.class);
startActivity(intent);
finish();
Call finish() when you move to your signin page. This'll finish the signup form and the first page will show up as your background.