YouTube live Stream partially working on android - android

I finally got YouTube live streaming to play on my app, the only inconvenience is when I go into full screen mode the player stops and it doesn't play anymore, also sometimes when I stop the player and try to play again it plays for 2 seconds then stops, I know YouTube live is on beta stage but that doesn't mean we couldn't find a solution for this, does anybody have any suggestions on how to solve this issue?
LiveYouTube.java
public class LiveYouTube extends YouTubeBaseActivity implements YouTubePlayer.OnInitializedListener {
public static final String API_KEY = "AIzaSyBMwV1heA9q75LkybRCK5SXXTJWADRtmDh4";
//http://youtu.be/<VIDEO_ID>
public static final String VIDEO_ID = "URS94beDtJA";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/** attaching layout xml **/
setContentView(R.layout.youtubelive);
/** Initializing YouTube player view **/
YouTubePlayerView youTubePlayerView = (YouTubePlayerView) findViewById(R.id.youtube_player);
youTubePlayerView.initialize(API_KEY, this);
}
#Override
public void onInitializationFailure(Provider provider, YouTubeInitializationResult result) {
Toast.makeText(this, "Failured to Initialize!", Toast.LENGTH_LONG).show();
}
#Override
public void onInitializationSuccess(Provider provider, YouTubePlayer player, boolean wasRestored) {
/** add listeners to YouTubePlayer instance **/
player.setPlayerStateChangeListener(playerStateChangeListener);
player.setPlaybackEventListener(playbackEventListener);
/** Start buffering **/
if (!wasRestored) {
player.cueVideo(VIDEO_ID);
}
}
private PlaybackEventListener playbackEventListener = new PlaybackEventListener() {
#Override
public void onBuffering(boolean arg0) {
}
#Override
public void onPaused() {
}
#Override
public void onPlaying() {
}
#Override
public void onSeekTo(int arg0) {
}
#Override
public void onStopped() {
}
};
private PlayerStateChangeListener playerStateChangeListener = new PlayerStateChangeListener() {
#Override
public void onAdStarted() {
}
#Override
public void onError(ErrorReason arg0) {
}
#Override
public void onLoaded(String arg0) {
}
#Override
public void onLoading() {
}
#Override
public void onVideoEnded() {
}
#Override
public void onVideoStarted() {
}
};
youtubelive.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout
android:id="#+id/rel"
android:layout_width="fill_parent"
android:layout_height="#dimen/play_list_row_height"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#c00311" >
<TextView
android:id="#+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:ellipsize="end"
android:gravity="center"
android:text="LIVE VIDEO"
android:textColor="#color/video_descrption_top_bar_text"
android:textSize="#dimen/video_view_top_bar_font_size"
android:textStyle="bold" />
</RelativeLayout>
<com.google.android.youtube.player.YouTubePlayerView
android:id="#+id/youtube_player"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:padding="0dp" />
<ImageView
android:id="#+id/logo"
android:layout_width="340dp"
android:layout_height="wrap_content"
android:layout_marginTop="-13dp"
android:src="#drawable/shadow_line" />

Related

Changing the video upon the changing of the link in YouTube player

I am pasting a link to video in edittext. I want the video to reload when the link is changed and button is clicked after it. The edit text take the http address, splits it accordingly to get the exact link for YouTube player. Each time the address is changed , the address string that is being passed to YouTube player is changed too.
I logged it and it's working fine. But the problem is that when I paste the URL for the first time, it works fine and loads the video, but once the video is loaded and i change the URL and press the button to play video, nothing happens. I guess the playerview is initialized and i cant reinitialize it? Is there a way to reinitialize it?
Here is my code of XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/search"
android:hint="Paste the link here"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Play Video"
android:layout_centerHorizontal="true"
android:layout_below="#+id/search"
android:id="#+id/play"/>
<com.google.android.youtube.player.YouTubePlayerView
android:id="#+id/youtube"
android:layout_below="#+id/play"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"/>
</RelativeLayout>
And the code to java file is :
public class YoutubeMain extends YouTubeBaseActivity implements YouTubePlayer.OnInitializedListener {
public static final String API_KEY = "api key";
public String VIDEO_ID;
Button playvideo;
EditText videoid;
public Boolean clicked;
YouTubePlayer myoutubeplayer;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.youtube);
videoid=(EditText)findViewById(R.id.search);
playvideo=(Button)findViewById(R.id.play);
playvideo.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
clicked=true;
if (videoid.getText().toString().contains("="))
{
Log.d("Youtube","the id is:"+videoid.getText().toString());
int start = videoid.getText().toString().indexOf("=");
String suffix = videoid.getText().toString().substring(start + 1);
Log.d("Youtube","the id after cropping is: "+suffix);
VIDEO_ID=suffix;
}
else
{
Log.d("Youtube","the id is:"+videoid.getText().toString());
int start = videoid.getText().toString().indexOf(".");
String suffix = videoid.getText().toString().substring(start + 4);
Log.d("Youtube","the id after cropping is: "+suffix);
VIDEO_ID=suffix;
}
Log.d("Youtube","Suffix:" +VIDEO_ID);
YouTubePlayerView youTubePlayerView = (YouTubePlayerView) findViewById(R.id.youtube);
youTubePlayerView.initialize(API_KEY, YoutubeMain.this);
}
});
}
#Override
public void onInitializationFailure(Provider provider, YouTubeInitializationResult result) {
Toast.makeText(this, "Failured to Initialize!", Toast.LENGTH_LONG).show();
}
#Override
public void onInitializationSuccess(Provider provider, YouTubePlayer player, boolean wasRestored) {
/** add listeners to YouTubePlayer instance **/
player.setPlayerStateChangeListener(playerStateChangeListener);
player.setPlaybackEventListener(playbackEventListener);
/** Start buffering **/
if (!wasRestored) {
player.cueVideo(VIDEO_ID);
}
Log.d("Youtube","The value of clicked is : "+clicked);
}
private PlaybackEventListener playbackEventListener = new PlaybackEventListener() {
#Override
public void onBuffering(boolean arg0) {
}
#Override
public void onPaused() {
}
#Override
public void onPlaying() {
}
#Override
public void onSeekTo(int arg0) {
}
#Override
public void onStopped() {
}
};
private PlayerStateChangeListener playerStateChangeListener = new PlayerStateChangeListener() {
#Override
public void onAdStarted() {
}
#Override
public void onError(ErrorReason arg0) {
}
#Override
public void onLoaded(String arg0) {
}
#Override
public void onLoading() {
}
#Override
public void onVideoEnded() {
}
#Override
public void onVideoStarted() {
}
};
}
Try this!!!
private static final int RECOVERY_REQUEST = 1;
#Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {
if(!b){
startHttp(strUrl, youTubePlayer);
}
}
#Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult errorReason) {
if (errorReason.isUserRecoverableError()) {
errorReason.getErrorDialog(this, RECOVERY_REQUEST).show();
} else {
String error = String.format(getString(R.string.player_error), errorReason.toString());
Toast.makeText(this, error, Toast.LENGTH_LONG).show();
}
}
private void startHttp(final String strUrl, final YouTubePlayer youTubePlayer) {
youTubePlayer.cueVideo(strUrl);
}
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == RECOVERY_REQUEST) {
// Retry initialization if user performed a recovery action
getYouTubePlayerProvider().initialize(Config.YOUTUBE_API_KEY, this);
}
}
protected YouTubePlayer.Provider getYouTubePlayerProvider() {
return youTubePlayerView;
}

Android - YouTubePlayer Play Live

I am using YouTube Android Player API to do a project about youtube live.
public class YoutubeLiveActivity extends AppCompatActivity implements YouTubePlayer.OnInitializedListener {
private Context mContext = this;
YouTubePlayerSupportFragment youTubePlayerFragment;
private YouTubePlayer player;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_youtube_live);
youTubePlayerFragment = (YouTubePlayerSupportFragment) getSupportFragmentManager().findFragmentById(R.id.youtube_fragment);
youTubePlayerFragment.initialize(API_KEY, this);
}
private void playVideoAtSelection() {
if (!(player == null)) {
player.loadVideo(LIVE_ID);
}
}
#Override
public void onInitializationSuccess(YouTubePlayer.Provider arg0, YouTubePlayer arg1, boolean arg2) {
this.player = arg1;
playVideoAtSelection();
}
#Override
public void onInitializationFailure(YouTubePlayer.Provider arg0, YouTubeInitializationResult arg1) {
}
}
YouTubePlayer cannot play the live and display "An error occurred Tap to retry". However, it can play a normal video. Please help!!
********** Updated **********
I found the problem about cannot play live video on YouTubePlayer. It is because the youtube version of mobile is not the latest version. Once updated the youtube on play store, the live video can play normally.
// Use the Youtube player.
public class YouTubePlayerActivity extends YouTubeBaseActivity implements YouTubePlayer.OnInitializedListener {
public String videoId = "";
private YouTubePlayer.PlaybackEventListener playbackEventListener = new YouTubePlayer.PlaybackEventListener() {
#Override
public void onBuffering(boolean arg0) {
}
#Override
public void onPaused() {
}
#Override
public void onPlaying() {
}
#Override
public void onSeekTo(int arg0) {
}
#Override
public void onStopped() {
}
};
private YouTubePlayer.PlayerStateChangeListener playerStateChangeListener = new YouTubePlayer.PlayerStateChangeListener() {
#Override
public void onAdStarted() {
}
#Override
public void onError(YouTubePlayer.ErrorReason arg0) {
}
#Override
public void onLoaded(String arg0) {
}
#Override
public void onLoading() {
}
#Override
public void onVideoEnded() {
finish();
}
#Override
public void onVideoStarted() {
}
};
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_you_tube_player);
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
videoId = bundle.getString(CommonUtils.INTENT_YOUTUBE_VIDEO_ID);
}
YouTubePlayerView youTubePlayerView = (YouTubePlayerView) findViewById(R.id.youtube_player);
youTubePlayerView.initialize(CommonUtils.You_Tube_Api_Key, this);
}
#Override
protected void onResume() {
super.onResume();
}
#Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult result) {
Toast.makeText(this, "Error: Fail to Initialize!", Toast.LENGTH_LONG).show();
}
#Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player, boolean wasRestored) {
player.setPlayerStateChangeListener(playerStateChangeListener);
player.setPlaybackEventListener(playbackEventListener);
if (!wasRestored) {
player.cueVideo(videoId);
}
}
}
activity_you_tube_player.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.youtube.player.YouTubePlayerView
android:id="#+id/youtube_player"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#000"
android:padding="0dp" />
</LinearLayout>
Download Youtube jar File From this link, and Copy it into libs folder
[https://developers.google.com/youtube/android/player/downloads/][1]

cancel method doesn't work in Count Down Timer class?

I designed an app that has two buttons one to start a counter and a second one to stop. Starting the counter works fine but when I click the stop button the app crashes.
What is the problem with my code?
public class MainActivity extends AppCompatActivity {
int i=1;
TextView txt;
Counter ct;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void bustart(View view) {
startTime();
}
public void buop(View view) {
ct.cancel();
}
public void startTime(){
i=1;
txt=(TextView)findViewById(R.id.textView);
ct=new Counter(5000,1000);
ct.start();
}
public class Counter extends CountDownTimer{
Counter(long millisInFuture,long countDownInterval){
super(millisInFuture,countDownInterval);
}
public void onTick(long millisUntilFinished) {
txt.setText(String.valueOf(i));
i++;
}
public void onFinish() {
txt.setText("Done");
}
}
}
Insure You Are give buop onClick to your Xml.,,Like that
<Button
android:id="#+id/btn1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="buop"
android:layout_centerInParent="true"
android:padding="20dp"
android:text="Cancel"
android:visibility="visible"
/>
<Button
android:id="#+id/btn2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="bustart"
android:layout_centerInParent="true"
android:padding="20dp"
android:text="Start"
android:visibility="visible"
android:layout_below="#+id/btn1"
/>
Take boolean to ensure timer is start other if you cancel button without start is crash generate. otherwise your code fine...
boolean timerStart=false;
public void bustart(View view) {
if(!timerStart) {
timerStart=true;
startTime();
}
}
public void buop(View view) {
if(timerStart) {
timerStart=false;
ct.cancel();
}
}

RecognitionListener doesn't call onEndOfSpeech immediately after user stops talking?

So I am using SpeechRecognizer along with RecognitionListener to recognize user speech. It works fine but the problem is when I tested it I noticed that it doesn't call onEndOfSpeech after I finishes talking. It waits around 7 to 10 seconds and then onEndOfSpeech and onResult are called. I don' know the reason for this delay.
Here is the code:
public class MainActivity extends AppCompatActivity {
protected static final int REQUEST_OK = 1;
SpeechRecognizer sr;
TextView mText;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mText = (TextView) findViewById(R.id.text1);
RecognitionListener recognitionListener=new RecognitionListener() {
#Override
public void onReadyForSpeech(Bundle bundle) {
Toast.makeText(MainActivity.this,"Start takling",Toast.LENGTH_SHORT).show();
}
#Override
public void onBeginningOfSpeech() {
}
#Override
public void onRmsChanged(float v) {
}
#Override
public void onBufferReceived(byte[] bytes) {
}
#Override
public void onEndOfSpeech() {
Toast.makeText(MainActivity.this,"onEndOfSpeech",Toast.LENGTH_SHORT).show();
}
#Override
public void onError(int i) {
}
#Override
public void onResults(Bundle bundle) {
Toast.makeText(MainActivity.this,"onResults",Toast.LENGTH_SHORT).show();
ArrayList<String> voiceResults =
bundle.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
if (voiceResults != null) {
String text = voiceResults.get(0);
Toast.makeText(MainActivity.this,text,Toast.LENGTH_SHORT).show();
}
}
#Override
public void onPartialResults(Bundle bundle) {
}
#Override
public void onEvent(int i, Bundle bundle) {
}
};
sr = SpeechRecognizer.createSpeechRecognizer(this);
sr.setRecognitionListener(recognitionListener);
findViewById(R.id.button1).setOnClickListener( new View.OnClickListener() {
#Override
public void onClick(View v)
{
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "en-US");
sr.startListening(intent);
}
});
}
#Override
protected void onDestroy() {
super.onDestroy();
sr.destroy();
}
}
activity_main.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<TextView
android:id="#+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="132dp"
android:text="..." ></TextView>
<ImageButton
android:id="#+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/text1"
android:layout_centerHorizontal="true"
android:layout_margin="10dp"
android:layout_marginTop="37dp"
android:src="#android:drawable/ic_btn_speak_now" ></ImageButton>
</RelativeLayout>

Manage Circular SeekBar throughout the app

I am working on an app that is used to stream songs online. I am able to play the song on clicking on it.
The problem with me is that I have a CircularSeekBar in all the Activities and I need to manage it on all the screens. If a song is played from any activity CircularSeekBar should be visible on all the screens. What I am able to do is When a song is played I am able to show the seekbar on that particular activity but not able to manage that seekbar on any other activity.
Below is the sample of one of my xml files:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/white"
android:orientation="vertical">
</LinearLayout>
<include layout="#layout/seek_bar_layout"></include>
</android.support.design.widget.CoordinatorLayout>
Please let me know how to manage that Seekbar on all the Activities.
Thanks in Advance.
You can't manage activity view when other is visible.
You can solve it by any boolean flag (for example: isSongPlaying = false). When you start playing your song set it to true. In each activity in onResume check that flag and show / hide your SeekBar.
Try to avoid using public static and use any other way.
EDIT:
According to your comments i created very simple example how you can solve your problem using service. Remember this code need much improvements.
SongService
public class SongService extends Service {
ActivityManager activityManager;
IBinder iBinder;
boolean playingSong = false;
Worker worker;
public SongService() {
iBinder = new MyBinder();
}
private void playSong(String path) {
if(worker != null) {
worker.cancel(true);
}
worker = new Worker();
worker.execute();
}
#Nullable
#Override
public IBinder onBind(Intent intent) {
return iBinder;
}
#Override
public int onStartCommand(Intent intent, int flags, int startId) {
return super.onStartCommand(intent, flags, startId);
}
private class Worker extends AsyncTask<Void, Integer, Void> {
#Override
protected void onPreExecute() {
super.onPreExecute();
playingSong = true;
}
#Override
protected Void doInBackground(Void... params) {
for (int i = 100; i > -1; i--) {
publishProgress(i);
try {
Thread.sleep(100l);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return null;
}
#Override
protected void onProgressUpdate(Integer... values) {
super.onProgressUpdate(values);
if (activityManager != null) {
activityManager.publishProgress(values[0]);
}
}
#Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
playingSong = false;
activityManager.onSongFinish();
}
}
public class MyBinder extends Binder {
public SongService getSongService() {
return SongService.this;
}
public void BindView(ActivityManager activityManager) {
SongService.this.activityManager = activityManager;
}
public void playSong(String path) {
SongService.this.playSong(path);
}
public boolean isPlayingSong() {
return playingSong;
}
}
public interface ActivityManager {
void publishProgress(int progress);
void onSongFinish();
}
}
MainActivity:
public class MainActivity
extends AppCompatActivity
implements ServiceConnection, SongService.ActivityManager {
TextView progress;
Button play;
Button next;
SongService.MyBinder myBinder;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
progress = (TextView) findViewById(R.id.progress);
play = (Button) findViewById(R.id.play);
play.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
if(myBinder != null) {
//Your path to song
myBinder.playSong("");
play.setEnabled(false);
}
}
});
next = (Button) findViewById(R.id.next);
next.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, MainActivity2.class);
startActivity(intent);
}
});
}
#Override
protected void onStart() {
super.onStart();
Intent mIntent = new Intent(this, SongService.class);
bindService(mIntent, this, BIND_AUTO_CREATE);
}
#Override
protected void onStop() {
super.onStop();
unbindService(this);
}
#Override
public void onServiceConnected(ComponentName name, IBinder service) {
if(service instanceof SongService.MyBinder) {
myBinder = (SongService.MyBinder) service;
myBinder.BindView(this);
if (myBinder.isPlayingSong()) {
play.setEnabled(false);
}
else {
play.setEnabled(true);
}
}
}
#Override
public void onServiceDisconnected(ComponentName name) {
myBinder = null;
}
#Override
public void publishProgress(int progress) {
this.progress.setText("Progress: " + progress);
}
#Override
public void onSongFinish() {
play.setEnabled(true);
}
}
MainActivity2
This activity class looks exacly the same like MainActivity but have different layout file.
MainActivity - Layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="com.example.aszymanski2.serviceanddelegatepatternexample.MainActivity">
<TextView
android:id="#+id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:text="Play"
android:id="#+id/play"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"/>
<Button
android:text="SecondActivity"
android:id="#+id/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"/>
</RelativeLayout>
MainActivity2 - Layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="com.example.aszymanski2.serviceanddelegatepatternexample.MainActivity">
<TextView
android:id="#+id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:text="Play"
android:id="#+id/play"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"/>
<Button
android:text="Back"
android:id="#+id/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"/>
</RelativeLayout>

Categories

Resources