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

Apps Surface View Player

Hey guys, i started to make my own tv app cause wanted to add my idea's..lol

so i got lots of it going but stuck on this surfaceview issue

1.when i click a link the screen gow's black then loads the video?

i think i found it. by adding:
Java:
@override
public void surfaceDestroyed(SurfaceHolder arg0) {
    if (mediaPlayer != null) {
        mCurrentVideoPosition = mediaPlayer.getCurrentPosition();
        mediaPlayer.release();
        mediaPlayer = null;
    }
}

2.when i press back to go back to the main screen ,seems like it created layers everytime i click a link...
is there a way to destroy the previous and make a new one every click?to avoid that..


Java:
@Override
    public void surfaceCreated(SurfaceHolder arg0) {
        if(mStream_id != null){
            String contentUri = Url + "live/" + username + "/" + password + "/" + mStream_id + ".ts";
            try {
                mediaPlayer = new MediaPlayer();
                mediaPlayer.setDisplay(vidHolder);
                mediaPlayer.setDataSource(contentUri);
                mediaPlayer.prepare();
                mediaPlayer.setOnPreparedListener(this);
                mediaPlayer.setOnBufferingUpdateListener(this);
                mediaPlayer.setOnCompletionListener(this);
                mediaPlayer.setScreenOnWhilePlaying(true);
                mediaPlayer.setOnVideoSizeChangedListener(this);
                mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
            } catch (IllegalArgumentException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (SecurityException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IllegalStateException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

        }
    }

Apps Scheduled Runs

I'm trying to schedule the running of a function in the MainActivity thread. I've tried both an AlarmManager and a Handler. They both look like they're going through, but nothing ever runs at the time it's supposed to. Not sure what I'm doing wrong here. Any help would be greatly appreciated. Admittedly, I'm a bit noobish, though this is my second app (both very basic).

The relevant sections of the code for Handler:
Java:
    public Runnable r;
    public Handler TSH = new Handler();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
...
        r = new Runnable() {
            @Override
            public void run() {         Log.d("Tag","Hi Again");
                RefreshList();}
        };
Calendar c1 = Calendar.getInstance();
c1.add(Calendar.MINUTE,1);
TSH.postAtTime(r, c1.getTimeInMillis());

The relevant sections of the code for AlarmManager:
Java:
public class TrainCheckerAlarm  extends BroadcastReceiver {
    public MainActivity ma;

    public void GetMA(MainActivity m) {ma = m;}

    @Override
    public void onReceive(Context context, Intent intent)
    {
        ma.RefreshList();
    }
    public void setAlarm(Context context, Calendar cal)
    {
        AlarmManager am =( AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
        Intent i = new Intent(context, TrainCheckerAlarm.class);
        PendingIntent pi = PendingIntent.getBroadcast(context, 0, i, 0);
        am.set(AlarmManager.ELAPSED_REALTIME, cal.getTimeInMillis(), pi);
    }
}
Then in MainActivity, there's a:
public TrainCheckerAlarm TCA = new TrainCheckerAlarm();
TCA.GetMA(this);
TCA.setAlarm(this,c1);

App Inventor How to play video fullscreen with landscape in Android WebView?

Person I have an application that I have a html5 player I have also a code that makes my webview accept that this html 5 enables the full screen player option. It even needs to be with screen rotation enabled to be able to see landscape but I want it to be landscape when I click the full screen option. How do I do it?

code down:
class Browser_home extends WebViewClient {

Browser_home() {
mInterstitialAd.show ();
}

@override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
mInterstitialAd.show ();
super.onPageStarted(view, url, favicon);

}

@override
public void onPageFinished(WebView view, String url) {
mInterstitialAd.show ();
setTitle(view.getTitle());
super.onPageFinished(view, url);



}
}





private class MyChrome extends WebChromeClient {

private View mCustomView;
private WebChromeClient.CustomViewCallback mCustomViewCallback;
protected FrameLayout mFullscreenContainer;
private int mOriginalOrientation;
private int mOriginalSystemUiVisibility;


MyChrome() {mInterstitialAd.show ();}

public Bitmap getDefaultVideoPoster()
{
if (mCustomView == null) {
mInterstitialAd.show ();
return null;

}
mInterstitialAd.show ();
return BitmapFactory.decodeResource(getApplicationContext().getResources(), 2130837573);
}

public void onHideCustomView()
{
mInterstitialAd.show ();
((FrameLayout)getWindow().getDecorView()).removeView(this.mCustomView);
this.mCustomView = null;
getWindow().getDecorView().setSystemUiVisibility(this.mOriginalSystemUiVisibility);
setRequestedOrientation(this.mOriginalOrientation);
this.mCustomViewCallback.onCustomViewHidden();
this.mCustomViewCallback = null;

}

public void onShowCustomView(View paramView, WebChromeClient.CustomViewCallback paramCustomViewCallback)
{
if (this.mCustomView != null)
{
mInterstitialAd.show ();
onHideCustomView();

return;
}
mInterstitialAd.show ();
this.mCustomView = paramView;
this.mOriginalSystemUiVisibility = getWindow().getDecorView().getSystemUiVisibility();
this.mOriginalOrientation = getRequestedOrientation();
this.mCustomViewCallback = paramCustomViewCallback;
((FrameLayout)getWindow().getDecorView()).addView(this.mCustomView, new FrameLayout.LayoutParams(-1, -1));
getWindow().getDecorView().setSystemUiVisibility(3846);

}

}

Help Weather Bug Alert Notification

I really like weather bug, but can't seem to get the weather alert notifications to work. I've even got a cool thunder clap picked out for the sound.

I've got everything set in weather bug, I get the temp notification, and the alert notification icon will show up, but no sound.

Anyone have this issue?
Yes I do I have tryed everything it's. Told me to do. Help

Help Headphone doesn't work

It's very rare that "X doesn't work" is sufficient information to let someone else solve the problem. So a couple of things to check:

Do the headphones work with another device?
- if not, they're probably broken.

Do other headphones work with this phone?
- if not, check carefully that there's no dirt in the socket, and make sure you are able to push them in all of the way. A badly-designed case may interfere with plugging in too.

If the answer to both is yes, definitely check they plug in correctly. Then give us as much information as you can.

If the answer to both is no, and you are sure that you can plug them in properly, then the problem is the phone, but we need to work out whether it's hardware or software.

Oh, and I've been assuming they don't work at all. If it's only calls that don't work that would be important to know as well.

How to use custom font in Image Asset in Android Studio?

I was trying to change the application icon of my project. I figured out i had to use Image Asset to create it. I chose the background image and while i chose the foreground to have text. I couldn't use a custom font in it. Any solutions?

nDPmy.png


I tried to check the xml files created by it after clicking OK.. but couldn't find any font-family attribute there. Also tried to search how to add custom fonts to source asset but with no success I only found the answers to add them to the project instead of Image Asset.

Google calendar to new phone might deleted

But please note the exact words that our friends used here: remove the account. And do this before wiping the phone.

This is not to protect your calendar, it makes no difference there if you remove the account from the phone or just reset it. But it's to avoid problems with factory reset protection: if you leave the account on and reset the phone the buyer will find that they need to use your Google account to get back into it! So to avoid an irate buyer having to ask you your login details or returning the phone you should remove the account first.

Filter

Back
Top Bottom