I'm working in news feed like activity which contain list view. The list view contains multiple videos, When i click the video view i open another activity and play the video in fullscreen mode. When i back pressed the activity cannot move to previous activity which contain listview.
when i pressed back button the same activity loads it doesn't go to previous activity
Even i try
finish()
moveTaskToBack(true);
But no use....
Following codes are i have used
ListviewActivity
Intent intent = new Intent(MainActivity.this, VideoActivity.class);
intent.putExtra("VideoURL", MY_VIDEO_URL);
startActivity(intent);
VideoActivity
public class VideoActivity extends Activity {
VideoView videoSurface;
ProgressDialog pDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.video_activity);
ToastMsg.displayShortToastMsg("CREATE");
String videoUrl = getIntent().getStringExtra("VideoURL");
pDialog = new ProgressDialog(VideoActivity.this);
pDialog.setMessage("Loading Please Wait...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(false);
pDialog.show();
videoSurface = (VideoView) findViewById(R.id.videoSurface);
try {
// Start the MediaController
MediaController mediacontroller = new MediaController(
VideoActivity.this);
mediacontroller.setAnchorView(videoSurface);
// Get the URL from String VideoURL
Uri video = Uri.parse(videoUrl);
videoSurface.setMediaController(mediacontroller);
videoSurface.setVideoURI(video);
} catch (Exception e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
videoSurface.requestFocus();
videoSurface.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
// Close the progress bar and play the video
public void onPrepared(MediaPlayer mp) {
pDialog.dismiss();
videoSurface.start();
}
});
}
@Override
public void onBackPressed() {
super.onBackPressed();
}
}
My Manifest File
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:uses-implied-permission="http://schemas.android.com/apk/res-
auto"
package="com.stage.lookara"
android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<application
android:name=".app.AppController"
android:allowBackup="true"
android:configChanges="orientation|keyboardHidden|screenSize"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.Social">
<activity
android:name=".DashBoard"
android:label="@string/app_name"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"
/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT"
/>
<data android:host="www.youtube.com"
android:mimeType="text/*" />
</intent-filter>
</activity>
<activity
android:name=".SettingsPage"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".Search"
android:screenOrientation="portrait" />
<activity
android:name=".LookaraNotification"
android:screenOrientation="portrait" />
<activity
android:name=".Login"
android:noHistory="true"
android:screenOrientation="portrait" />
<activity
android:name=".social.SocialActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan|adjustResize" />
<activity
android:name=".social.Comment"
android:screenOrientation="portrait" />
<activity
android:name=".social.ReplyComment"
android:screenOrientation="portrait" />
<activity
android:name=".social.SinglePost"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.DeviceDefault.Light.DialogWhenLarge.NoActionBar" />
<activity
android:name=".social.Profile"
android:screenOrientation="portrait" />
<activity
android:name=".social.FriendProfileView"
android:screenOrientation="portrait" />
<activity
android:name=".social.Friends"
android:screenOrientation="portrait" />
<activity
android:name=".social.IndividualChat"
android:screenOrientation="portrait" />
<activity
android:name=".social.Photos"
android:screenOrientation="portrait" />
<activity
android:name=".social.AlbumViewer"
android:screenOrientation="portrait" />
<activity
android:name=".social.VideoActivity"
android:configChanges="orientation|keyboardHidden|screenSize"/>
<activity
android:name=".social.Event"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".social.JournalActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".social.SocialEditEvents"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".social.SocialFollowers"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".social.SingleEvent"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".social.Message"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".social.GalleryView"
android:screenOrientation="portrait" />
<activity
android:name=".social.Channel"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".social.MyChannel"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".social.ChannelCreateForm"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".social.ChannelMembers"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".social.ReportDetails"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".social.InvitesList"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".social.OtherUserChannelList"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".social.ChannelProfilePage"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".social.Ask"
android:screenOrientation="portrait" />
<activity
android:name=".social.AskPost"
android:screenOrientation="portrait" />
<activity
android:name=".social.Journal"
android:screenOrientation="portrait" />
<activity
android:name=".PreviewActivity"
android:screenOrientation="portrait" />
<activity
android:name=".social.ChatMessages"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize|adjustPan" />f
<activity
android:name=".social.CreateSocial"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize|adjustPan" />
<activity
android:name=".social.OtherUserFriends"
android:screenOrientation="portrait" />
<activity
android:name=".professinal.ProfessionalSearch"
android:screenOrientation="portrait" />
<activity
android:name=".professinal.ProfessionalActivity"
android:screenOrientation="portrait" />
<activity
android:name=".professinal.CreateProfessional"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".professinal.ProfessionalFollowers"
android:screenOrientation="portrait" />
<activity
android:name=".professinal.ProfessionalJournals"
android:screenOrientation="portrait" />
<activity
android:name=".professinal.ProfessionalConnections"
android:screenOrientation="portrait" />
<activity
android:name=".professinal.FindProfessional"
android:screenOrientation="portrait" />
<activity
android:name=".professinal.ProfessionalMessage"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".professinal.ProfessionalProfile"
android:screenOrientation="portrait" />
<activity
android:name=".common.Reviews"
android:screenOrientation="portrait" />
<activity
android:name=".bussiness.BusinessActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".bussiness.BusinessSearch"
android:screenOrientation="portrait" />
<activity
android:name=".bussiness.Partners"
android:screenOrientation="portrait" />
<activity
android:name=".bussiness.BusinessSettings"
android:screenOrientation="portrait" />
<activity
android:name=".bussiness.CreateBusiness"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".bussiness.BusinessFollowers"
android:screenOrientation="portrait" />
<activity
android:name=".bussiness.BusinessJournals"
android:screenOrientation="portrait" />
<activity
android:name=".bussiness.BusinessList"
android:screenOrientation="portrait" />
<activity
android:name=".bussiness.BusinessMessage"
android:screenOrientation="portrait" />
<activity
android:name=".bussiness.BusinessProfile"
android:screenOrientation="portrait" />
<activity
android:name=".bussiness.BusinessOverView"
android:screenOrientation="portrait" />
<activity
android:name=".bussiness.BusinessSpecialOffer"
android:screenOrientation="portrait" />
<activity
android:name=".bussiness.ContactDetails"
android:screenOrientation="portrait" />
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden
|screenLayout|screenSize|orientation"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
/>
<activity
android:name="com.darsh.multipleimageselect.
activities.AlbumSelectActivity"
android:theme="@style/MultipleImageSelectTheme">
<intent-filter>
<category android:name="android.intent.category.DEFAULT"
/>
</intent-filter>
</activity>
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/FB_APP_ID" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<receiver
android:name=".NetworkChangeReceiver"
android:label="NetworkChangeReceiver">
<intent-filter>
<action
android:name="android.net.conn.CONNECTIVITY_CHANGE" />
<action
android:name="android.net.wifi.WIFI_STATE_CHANGED" />
</intent-filter>
</receiver>
<service android:name=".common.LookaraService" />
<service android:name=".common.LookaraUploadService" />
</application>
</manifest>