Hi everyone.
I am new to these forums and, in fact, new to Android programming, for which I apologise for both circumstances.
I am in a little of a position right now and could really do with a lot of understanding (sympathy and forgiveness) and assistance.
I have a display panel I need to get running very quickly. The display panel will be a 7" tablet running Android (Jelly Bean) 4.2, which will have three windows viewable to the user; each comprising of text and a video.
I originally wrote the basic system using HTML5 and CSS3 but realised that the swiping action between each view would be difficult to incorporate. I did consider Flash or even converting a PowerPoint presentation but the app idea seemed a relatively simple solution (even given my previous non-experience).
I have installed Eclipse and have begun coding a little bit but cannot currently get the video working at all. I am also aware that once I get this working I will need help with each and every other step, hence the sympathy and understanding.
My activity_main is:
[HIGH]<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:background="#000000"
android
addingBottom="@dimen/activity_vertical_margin"
android
addingLeft="@dimen/activity_horizontal_margin"
android
addingRight="@dimen/activity_horizontal_margin"
android
addingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world"
android:textColor="#ffffff" />
<VideoView
android:id="@+id/vidView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="202dp"
android:layout_marginLeft="400dp"
android:layout_toRightOf="@+id/textView1" />
</RelativeLayout>[/HIGH]I created a new java file and called it playvid.java, which contains:
[HIGH]package com.garynewport.c5app;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.Toast;
import android.widget.VideoView;
public class playvid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
VideoView myVideoView = (VideoView) findViewById(R.id.vidView);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(myVideoView);
try{
String vidpath = "android.resource://" + getPackageName() + "/" + R.raw.rsr;
myVideoView.setVideoURI(Uri.parse(vidpath));
myVideoView.setMediaController(new MediaController(this));
myVideoView.requestFocus();
myVideoView.start();
}
catch (Exception e){
Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_SHORT);
}
}
}[/HIGH]Now I have stolen the code from elsewhere and did some editing myself but then returned to normal when nothing worked. I have three videos that I placed in a folder called raw within the res folder inside my project area. Originally called vid1.mp4, vid2.mp4 and vid3.mp4 I changed the first one to rsr.mp4 to match the original instructions AND the code request.
I understand that the emulator may niot always work with videos so I exported the APK and installed it without issue onto the tablet but aside from the black background and the white text saying 'Hello world!" (yeah, I like the old ways), no video and lots of other bits I do not want.
Is there anyone who is willing to help me out here, knowing that this is a major request and not something I normally do but time is now my biggest issue.
I am new to these forums and, in fact, new to Android programming, for which I apologise for both circumstances.
I am in a little of a position right now and could really do with a lot of understanding (sympathy and forgiveness) and assistance.
I have a display panel I need to get running very quickly. The display panel will be a 7" tablet running Android (Jelly Bean) 4.2, which will have three windows viewable to the user; each comprising of text and a video.
I originally wrote the basic system using HTML5 and CSS3 but realised that the swiping action between each view would be difficult to incorporate. I did consider Flash or even converting a PowerPoint presentation but the app idea seemed a relatively simple solution (even given my previous non-experience).
I have installed Eclipse and have begun coding a little bit but cannot currently get the video working at all. I am also aware that once I get this working I will need help with each and every other step, hence the sympathy and understanding.
My activity_main is:
[HIGH]<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:background="#000000"
android
addingBottom="@dimen/activity_vertical_margin"android
addingLeft="@dimen/activity_horizontal_margin"android
addingRight="@dimen/activity_horizontal_margin"android
addingTop="@dimen/activity_vertical_margin"tools:context=".MainActivity" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world"
android:textColor="#ffffff" />
<VideoView
android:id="@+id/vidView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="202dp"
android:layout_marginLeft="400dp"
android:layout_toRightOf="@+id/textView1" />
</RelativeLayout>[/HIGH]I created a new java file and called it playvid.java, which contains:
[HIGH]package com.garynewport.c5app;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.Toast;
import android.widget.VideoView;
public class playvid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
VideoView myVideoView = (VideoView) findViewById(R.id.vidView);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(myVideoView);
try{
String vidpath = "android.resource://" + getPackageName() + "/" + R.raw.rsr;
myVideoView.setVideoURI(Uri.parse(vidpath));
myVideoView.setMediaController(new MediaController(this));
myVideoView.requestFocus();
myVideoView.start();
}
catch (Exception e){
Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_SHORT);
}
}
}[/HIGH]Now I have stolen the code from elsewhere and did some editing myself but then returned to normal when nothing worked. I have three videos that I placed in a folder called raw within the res folder inside my project area. Originally called vid1.mp4, vid2.mp4 and vid3.mp4 I changed the first one to rsr.mp4 to match the original instructions AND the code request.
I understand that the emulator may niot always work with videos so I exported the APK and installed it without issue onto the tablet but aside from the black background and the white text saying 'Hello world!" (yeah, I like the old ways), no video and lots of other bits I do not want.
Is there anyone who is willing to help me out here, knowing that this is a major request and not something I normally do but time is now my biggest issue.
