Android :: Video Intent - Control Back Button?
Sep 22, 2009
I'm working on an android application that plays video, by using an intent:tostart = new Intent(Intent. ACTION_ VIEW);tostart.setDataAndType(Uri.parse(movieurl), "video/*");startActivity(tostart);This works great. However, when you press the back button (on the device), the movieplayer goes back to the beginning of the movie. Only when you press back again, it goes back to my application. While the current behaviour makes some sense, I would like to know if I can change it: Is is possible to directly go back after pressing back?
View 1 Replies
Sep 2, 2010
I have 3 activities in my app: Activity1 -> Activity2 -> Activity3. Inside Activity3, if the user presses Back, I would like to return to Activity2. In Activity3's onPause event, I added a finish() statement. That's probably not even necessary, but I wanted to make sure this Activity gets cleaned up. This works fine.
However, while in Activity3, if the user presses Home or starts a new app (through notification bar or some other means), I want both Activity3 and Activity2 to finish. If the user returns to this app, he should resume with Activity1.
I have figured out how to do one or the other, but I can't figure out how to handle both cases, if it's even possible. Can I trap the "Back" button in Activity3 and send a message back to Activity2 telling it not to finish()? It seems like the Activities follow the same lifecycle flow (Pause, Stop) regardless of what you do to send them to the background. Just to answer the question of why I want this behavior, imagine that Activity1 is a login screen, Activity2 is a selection screen, and Activity3 is a content screen. If I press Back from the content page, I want to be able to make a new selection. If I exit via any other means (Home, notification bar), I want the user to be "logged out".
View 2 Replies
View Related
Aug 12, 2009
I want to get the Text data value from Sub-Activity back. And everything is ok. But when the Sub-activity was opened, then I just click back "button" on the phone, it throw an exception error. I found on the android NotePad life-cycle control toturial but It's hard to understand. Can someone help me? This is my code:
public class SBooks extends ListActivity {
private String title_raw;
private SBooksDbAdapter mDbHelper;private static final int ACTIVITY_SEARCH = 0;private static final int SEARCH_ID = Menu.FIRST; @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sbooks_list);
mDbHelper = new SBooksDbAdapter(this);
mDbHelper.open();
Create Menu Option
@Override public boolean onCreateOptionsMenu(Menu menu) {
boolean result = super.onCreateOptionsMenu(menu);
menu.add(0, SEARCH_ID, 0, R.string.menu_search);
return result;
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()){
case SEARCH_ID:
Intent intent = new Intent(this, SBooksSearch.class);
startActivityForResult(intent, ACTIVITY_SEARCH);
return super.onOptionsItemSelected(item);
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent){
super.onActivityResult(requestCode, resultCode, intent);
switch(requestCode){
case ACTIVITY_SEARCH:
Bundle bundle = intent.getExtras();
title_raw = bundle.getString(SBooksDbAdapter.KEY_TITLE_RAW);
if(title_raw!=null){
Cursor cursor = mDbHelper.searchData(title_raw);
String[] from = new String[]{ SBooksDbAdapter.KEY_ROWID,
SBooksDbAdapter.KEY_TITLE, SBooksDbAdapter.KEY_LYRICS };
int[] to = new int[]{ R.id.id, R.id.title, R.id.lyrics };
SimpleCursorAdapter adapter =
new SimpleCursorAdapter(this, R.layout.sbooks_row, cursor, from, to );
setListAdapter(adapter);This is my Sub-Activity:
public class SBooksSearch extends Activity {
private EditText mTextSearch;
private Button searchButton;
private SBooksDbAdapter mDbHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.sbooks_search);
mTextSearch = (EditText)findViewById(R.id.text_search);
searchButton = (Button)findViewById(R.id.btn_search);
searchButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
Intent intent = new Intent();
intent.putExtra(SBooksDbAdapter.KEY_TITLE_RAW, mTextSearch.getText().toString());
setResult(RESULT_OK, intent);
finish();
@Override
protected void onSaveInstanceState(Bundle outState){
super.onSaveInstanceState(outState);
@Override
protected void onPause(){
super.onPause();
checkState();
@Override
protected void onResume(){
super.onResume();
}private void checkState() {
This is Logcat:
08-12 18:44:39.211: WARN/InputManagerService(581): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@43719140 (uid=10004 pid=623)
08-12 18:44:39.510: INFO/ActivityManager(581): Displayed activity com.original.sbooks/.SBooks: 4934 ms
08-12 18:44:40.821: WARN/KeyCharacterMap(730): No keyboard for id 0
08-12 18:44:40.821: WARN/KeyCharacterMap(730): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
08-12 18:44:41.412: INFO/ARMAssembler(581): generated scanline__00000177:03515104_00001A01_00000000 [ 64 ipp] (89 ins) at [0x297608:0x29776c] in 952924 ns
08-12 18:44:41.520: INFO/ARMAssembler(581): generated scanline__00000177:03515104_00000A01_00000000 [ 46 ipp] (70 ins) at [0x297798:0x2978b0] in 517061 ns
08-12 18:44:42.171: INFO/ActivityManager(581): Starting activity: Intent { comp={com.original.sbooks/com.original.sbooks.SBooksSearch} }
08-12 18:44:52.196: WARN/ActivityManager(581): Launch timeout has expired, giving up wake lock!
08-12 18:44:52.279: WARN/ActivityManager(581): Activity idle timeout for HistoryRecord{436bfc80 {com.original.sbooks/com.original.sbooks.SBooksSearch}}
08-12 18:44:57.350: DEBUG/dalvikvm(620): GC freed 4103 objects / 231808 bytes in 75ms
08-12 18:45:05.130: DEBUG/dalvikvm(649): GC freed 2604 objects / 150112 bytes in 88ms
08-12 18:45:10.120: DEBUG/dalvikvm(623): GC freed 2750 objects / 149592 bytes in 71ms
08-12 18:45:11.920: INFO/ActivityManager(581): Displayed activity com.original.sbooks/.SBooksSearch: 29748 ms
08-12 18:45:17.263: WARN/ActivityManager(581): Activity pause timeout for HistoryRecord{436bfc80 {com.original.sbooks/com.original.sbooks.SBooksSearch}}
08-12 18:45:26.762: WARN/ActivityManager(581): Launch timeout has expired, giving up wake lock!
08-12 18:45:27.272: WARN/ActivityManager(581): Activity idle timeout for HistoryRecord{435a7760 {com.original.sbooks/com.original.sbooks.SBooks}}
08-12 18:46:04.905: DEBUG/AndroidRuntime(730): Shutting down VM
08-12 18:46:04.905: WARN/dalvikvm(730): threadid=3: thread exiting with uncaught exception (group=0x4000fe70)
08-12 18:46:04.905: ERROR/AndroidRuntime(730): Uncaught handler: thread main exiting due to uncaught exception
08-12 18:46:04.991: ERROR/AndroidRuntime(730): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=0, data=null} to activity {com.original.sbooks/com.original.sbooks.SBooks}: java.lang.NullPointerException
08-12 18:46:04.991: ERROR/AndroidRuntime(730): at android.app.ActivityThread.deliverResults(ActivityThread.java:3005)
08-12 18:46:04.991: ERROR/AndroidRuntime(730): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3047)
08-12 18:46:04.991: ERROR/AndroidRuntime(730): at android.app.ActivityThread.access$2300(ActivityThread.java:112)
08-12 18:46:04.991: ERROR/AndroidRuntime(730): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1721)
08-12 18:46:04.991: ERROR/AndroidRuntime(730): at android.os.Handler.dispatchMessage(Handler.java:99)
08-12 18:46:04.991: ERROR/AndroidRuntime(730): at android.os.Looper.loop(Looper.java:123)
08-12 18:46:04.991: ERROR/AndroidRuntime(730): at android.app.ActivityThread.main(ActivityThread.java:3948)
08-12 18:46:04.991: ERROR/AndroidRuntime(730): at java.lang.reflect.Method.invokeNative(Native Method)
08-12 18:46:04.991: ERROR/AndroidRuntime(730): at java.lang.reflect.Method.invoke(Method.java:521)
08-12 18:46:04.991: ERROR/AndroidRuntime(730): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
08-12 18:46:04.991: ERROR/AndroidRuntime(730): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
08-12 18:46:04.991: ERROR/AndroidRuntime(730): at dalvik.system.NativeStart.main(Native Method)
08-12 18:46:04.991: ERROR/AndroidRuntime(730): Caused by: java.lang.NullPointerException
08-12 18:46:04.991: ERROR/AndroidRuntime(730): at com.original.sbooks.SBooks.onActivityResult(SBooks.java:111)
08-12 18:46:04.991: ERROR/AndroidRuntime(730): at android.app.Activity.dispatchActivityResult(Activity.java:3595)
08-12 18:46:04.991: ERROR/AndroidRuntime(730): at android.app.ActivityThread.deliverResults(ActivityThread.java:3001)
View 2 Replies
View Related
Jun 1, 2014
i have a drawer menu, when i press one of its buttons to start a sharing intent as below:
Code:
Intent iFriends = new Intent(Intent.ACTION_SEND);
iFriends.setType("text/plain");
iFriends.putExtra(Intent.EXTRA_TEXT, "http://www.liveplus.mobi");
iFriends.createChooser(iFriends, "Invite Friends");
startActivity(iFriends);
The sharing dialog appears, but if i press the back button, the whole application exits!
View 1 Replies
View Related
Jul 15, 2010
This is my first android device and i'm loving it... but one thing that irks me is the use, or lack thereof, of the back button.
As I am navigating menus and options in the Settings, I cannot simply go back one menu using the back key. For example, if I go to Settings->Battery Manager->Battery Profile Options and want to go back to the Settings screen, I cannot.
Pushing the back button does nothing and I can only go back to the Settings menu by going Home, then re-entering.
Another quirk regarding the back button is when reading emails. Using a regular email account such as Hotmail, I cannot simply read an email and go back to the inbox using the button.
It makes navigating the phone very tedious.
View 5 Replies
View Related
Mar 31, 2009
I call WebView.clearHistory(), but I am still able to go back after doing so. I want to reuse a WebView, but I don't want the back button to allow the user to go back further than the current "session" of using the WebView. Anybody know what is the best way to handle this? I thought for sure that clearHistory() would do it.
View 3 Replies
View Related
Oct 11, 2010
In my android application i have a video list screen,a buffering screen and a videoplayer screen.
As soon as the user clicks an item from videolist screen ,he is navigated to buffering screen and then to videoplayer.
In the buffering screen i am using Async task and doing the loading process in on background process.
Now my issue is like the user if has selested a video then gets navigated to buffering screen.But if the user clicks back when he is in buffering screen then initially he is getting navigated to videolist screen but immediately after that again he is navigated to videoplayer screen.
What i would like to have is either the back button should be made disable in buffering or should prevent the player tostart if back is clicked.
View 2 Replies
View Related
Jun 16, 2009
In My code I am displaying a AlertDialog based on some condition.
CODE:.......................
View 2 Replies
View Related
Oct 28, 2010
I want to use the button style on another control.
How can I call that bg?
View 1 Replies
View Related
Mar 12, 2010
i have an android listview filled with items.Every item has a button.This is the template of the my listview.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingBottom="6dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="5px"
android:paddingTop="5px"
android:paddingRight="5px"
android:gravity="left">
<TextView android:id="@+id/TextView_test1"
android:layout_width="200dip"
android:paddingLeft="0px"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/TextView_test2"
android:layout_width="250dip"
android:paddingLeft="0px"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView android:id="@+id/TextView_test3"
android:layout_width="400dip"
android:paddingLeft="0px"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<Button
android:id="@+id/Button_buttontest"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Button_buttontest"/>
</LinearLayout>How could i handle the click of each button in the activity code?
Each button has the same id "Button_buttontest"?
View 1 Replies
View Related
Jul 19, 2010
I'm finding that I'm using the back button A LOT whether browsing the web or just navigating the OS. It kind of sucks because the buttons on the droid x are well, really small, and sometimes hard to press because they are so narrow and flimsy feeling. And depending on how you are holding the phone, it could be a good bit of distance for your thumb to travel or I'm finding myself having to reposition the phone in my hands just to reach the back button, which you seem to need very frequently.
Anyone know of any kind of back 'swipe' implementation ? Like some software you can install that makes it if you swipe left to right on maybe the top bar it goes back?
View 4 Replies
View Related
Oct 7, 2010
How do i get back the image taken from starting the Intent(MediaStore.ACTION_IMAGE_CAPTURE)?
I need the image to be display as a thumbnail and also be attached to email.
View 2 Replies
View Related
Nov 14, 2010
I'm working on an android app and I'm stuck. Here's the scenario that I have: The user picks a contact to call The user presses the dialer button to call that contact Android's native dial screen pops up i.e. Dialing Contact screen Here's what I want to do: after pressing the dialer button, is there any way for my app to control what pops up after pressing the dialer button?
View 1 Replies
View Related
Sep 20, 2010
I am writing a very small app that just opens the camera app ready for video. I am able to get my code to work on an Android 2.2 emulator, but it will not work on my device, Motorola Droid 1 stock 2.2 FRG22D. Any ideas where I went wrong on this code?
CODE:............
It appears ThorstenW is correct. I would upvote your answer if I had enough rep. You can see from the logcat that com.android.camera could not be found and throws a fatal exception. Logcat below.
CODE:...................
View 2 Replies
View Related
Nov 9, 2010
Does anyone know of an intent I can use to open a raw mp4 resource in the phone's video player?
I tried this code:
CODE:..............
This threw an ActivityNotFoundException, however this has worked for me when the URI was the sdcard and the video was located there. Does anyone know how I can use the above code with a resource file in my app?
View 1 Replies
View Related
Oct 15, 2009
I'm trying to play video's on Android, by launching an intent. The code ...
View 1 Replies
View Related
May 5, 2010
Instead of trying to grab the notification bar and swiping it down, simply start ABOVE the screen and swipe down. Fast or slow makes no difference.
You can swipe it back up, or simply hit the back button.
View 15 Replies
View Related
Sep 8, 2013
In the last few days I am having to press the back button twice when using both the stock android browser and the latest version of chrome on my rooted S3.
View 4 Replies
View Related
Apr 27, 2010
How can I maintain the position of my ListView in my activity when I go to another activity (by launching another intent) and then come back (press the back button)?
View 2 Replies
View Related
Oct 4, 2010
My activity has a set of buttons on the left half of the screen and a ListView on the right.Initially the focus is on the first button. When I browse the buttons by pressing DOWN arrow key and then press the RIGHT arrow key, the focus does not go to the topmost list item. Instead, the list item correspondingly on the right gets focused.Is there a way that when I press the RIGHT arrow key, the focus goes to the topmost item on the Listview?
View 1 Replies
View Related
Aug 22, 2009
I have trouble launching the WebBrowser with an Intent with a Button Click. I try doing this in the onCreate Method of my Activity:
CODE:...........
Its in the View like this:
CODE:...............
When i launch the Activity i get a force close with this in the log:
CODE:..........................
View 5 Replies
View Related
Aug 27, 2010
I got one question regarding the intent action "ACTION_CALL". What is the correct way of getting back to the own application/activity after the user ends the call? The only way that came to my mind uses a PhoneStateListener in a background services that waits for the CALL_STATE_IDLE event starting up the application again. But I am not quite sure if that is the correct/intended way of using the intent.
View 1 Replies
View Related
Sep 17, 2010
Is there any way to control the brightness of the 4 bottom buttons, the home, back, menu and search buttons? I use my phone to watch movies in bed when I can't sleep, and in a dark room those 4 things are really bright, and never turn off, it gets distracting.
View 4 Replies
View Related
Jul 28, 2009
My application has buttons to launch gallery and video camera apps but the below code only seems to work on phones with the standard Cupcake build:
// For Gallery Intent intent = new Intent(); intent.setClassName("com.android.camera", "com.android.camera.GalleryPicker");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(intent);
// For Video Camera Intent intent = new Intent(); intent.setClassName("com.android.camera", "com.android.camera.VideoCamera"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(intent);
On rooted / non-cupcake phones, I get this error:
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.camera/com.android.camera.VideoCamera};
have you declared this activity in your AndroidManifest.xml? at android.app.Instrumentation.checkStartActivityResult (Instrumentation.java:1480) at android.app.Instrumentation.execStartActivity(Instrumentation.java: 1454) at android.app.Activity.startActivityForResult(Activity.java:2656) at android.app.Activity.startActivity(Activity.java:2700)
View 3 Replies
View Related
Jun 21, 2012
I have searched XDA, Google and Play Store but can't find out if this has been done successfully before. Ideally what I am looking to do is implement tweaks on the stock camera on the One X to allow control of the camera shutter (and ideally zoom) by using the wired headset button. Is there an app around that does this, or even better a mod for the stock camera I could replicate/add to?
View 3 Replies
View Related
Jul 26, 2012
I've noticed that my mobile data is turning off by itself. Initially I thought it was JuiceDefender throwing a wobbly, but then I noticed that its event log was full of comments like "Mobile data is back under JD control" and something about reloading a profile. By watching the notification in the drop down menu I noticed that it was perpetually restarting itself.
I uninstalled it, and tried another app called 2x Battery and the same thing was happening. The data toggle in the setting menu of MIUI was greyed out to show data had been turned off, and 2x Battery stated that data had been toggled by the user.
It seems to be that a third party app is deactivating mobile data. Is there any app out there that can log when an app deactivates data, so I can find out the culprit?
View 5 Replies
View Related
Aug 5, 2010
On a Nexus One (for example), the camera application is able to capture H.264 video at 720x480 (the "High" quality setting). However, when using the MediaRecorder API, it always seems to capture at a fixed frame size of 320x240.
I would expect the setVideoSize() method to control the frame size (as in the prepare fragment below), but it appears to have no effect (using Froyo 2.2 Android SDK).code...
Discussions on the android developers list seem to indicate this is a long standing issue. Can anyone advise how the frame size can be controlled, or if it is possible at all with the current API?
View 2 Replies
View Related
Aug 26, 2010
Is it possible to call the built-in Video Recorder in Android through an implicit Intent? I did some search but haven't figured out yet.
View 1 Replies
View Related
Jun 27, 2010
This questions somehow relates to the question when I was looking to get the extras back in startActivityForResult but now I face another challenge.
I have subscribed to receive ProximityAlerts and I have explicitly constructed the Intent to include some Extras. But when I got the service the extras are not there.
After the answers here is the working code:
CODE:..........................
The documentation says param PendingIntent to be sent for each location update.
View 2 Replies
View Related
Jul 24, 2010
Wish there was a way to control the sound input while video recording. Anything above a normal conversation sounds horrible during playback. Anyone know of an app that might handle that?
View 1 Replies
View Related