Android :: StartActivity -intent - And Resume To Main Activity

Jul 2, 2010

I've got an app that creates an intent for the last.fm android app in which it will start the "recommended" station for my account when i press a button. The trick i'm trying to figure out is how do i get the phone back to my app without the user having to navigate back manually? Once it start the last.fm intent it takes you to the playlist and i need it to resume back to my app automatically.

Android :: startActivity -intent - and resume to main activity


Android :: StartActivity -ForResult - At The Creation Of Main Activity

Mar 31, 2010

I would like to display a an access dialog activity at the start of my application.

In other words, I would like to start another activity (in dialog theme) as soon as my Main Activity is loaded. But, I know that I can not start an activity while another is creating.

I tried to start this activity in the onResume() method : I can see the new activity called, but the Main activity do not respond after closing the new activity.

Is there a solution to do this, without using delayed intent ? May i use a special flag for my intent ? I did not find, in the activity cycle, a way to detect the end of activity loading.

View 6 Replies View Related

Android :: Exclude Own Activity From Activity.startActivity - Intent

Oct 17, 2010

My app works with pictures. It can take multiple pictures as an input, process them, and send them again to another app.

As a consequence, my main Activity has declared an intent filter on ACTION_SEND_MULTIPLE for image/* mimetypes and can result in issuing a new Intent with the same action and data type using Activity.startActivity(Intent).

Is there a way to exclude my own activity from the list of apps that is displayed to the user after the startActivity() call ?

View 1 Replies View Related

Android :: Pausing VideoView When Launching A New Intent / Resume It To Starts Up Activity Again?

Jul 23, 2009

I have an activity that is showing a video and when the user clicks a button, a new activity is launched. When the video activity stops, I pause the video view. When the video activity starts up again, I try to resume the video view videoView.start(), however, the video starts over from the beginning. I'm thinking that the buffer must be lost somewhere, so I now try to capture the current position via videoView.getCurrentPosition(), however, this is always returning 0.

Anybody know how to resume video playback when an activity starts up again?

View 5 Replies View Related

Android :: Pass Intent Via StartActivity() To A Running Activity

Aug 10, 2010

MyService and MyClient are both running, although MyClient is currently in the background. If MyService sends an Intent to MyClient via:

CODE:..............

How do I get this Intent in MyClient? Running this code triggers onResume() in MyClient, but because it's already running, calling getIntent() returns the Intent that initially created MyClient, which is always android.intent.action.MAIN

View 2 Replies View Related

Android :: Update Intent Of An Existing Activity While Calling StartActivity

Sep 13, 2010

I am having two activities, say activity A and B. Activity A is an ListActivity, and when the items in the list is selected, it will call startActivity() to bring up B. The problem here is that when I am in B and click the home key, and then go to the application launcher to resume my application, A will be brought up again. This time when I click a different item in A, it will bring up B with the old data of the previously selected item before the home key was clicked.

After examinzing the code, I found that the startActivity does not update the intent of B. I found a post here about the similar question, and the answer was to overwrite the onNewIntent. However, I found that it doesn't work, because this method never get called when the second time I call startActivity. I am sure that this is the same instance, because I've printed out the instance number. Is there any other ways to update the intent of the activity? Or I need some other settings to make the onNewIntent get called? I didn't set any flags or launch modes, so everything is default.

View 1 Replies View Related

Android :: Open An Intent - MapView - From Main Activity With Menu

Jan 13, 2010

I'm trying from main Activity (MainFile.java) to open a Map as a new intent through a menu. Something like this...

CODE:..............

And I already have set up thing on my manifest.xml with access to...

CODE:........

It worked fine with other File.class, but with the Map.class doesn't seem to be working.

View 1 Replies View Related

Android :: How To Make Notification Intent Resume Rather Than Making New One?

Jul 22, 2010

What I have here is a simple webview activity that when loaded it auto displays an ongoing notification. The idea is that people can navigate away from this activity and quickly access it again from any screen they want by pulling down the drop down menu and selecting it. Then when they want they can just close the notification by hitting the menu button and hitting exit and then the notification clears. This all works fine. However, when the notification is pressed it starts a new instance of the activity. What would I have to change to make it see if the activity has not already been destroyed and I can just call that instance back(resume it) and therefore not needing to load it again and won't need to add another activity to my stack.

package com.my.app;
import com.flurry.android.FlurryAgent;
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.webkit.CookieSyncManager;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;

public class Chat extends Activity {
private ProgressDialog progressBar;
public WebView webview;
private static final String TAG = "Main";
private NotificationManager mNotificationManager;
private int SIMPLE_NOTFICATION_ID;
@Override
public void onStart()
{ super.onStart();
CookieSyncManager.getInstance().sync();
FlurryAgent.onStartSession(this, "H9QGMRC46IPXB43GYWU1");
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.chat);
mNotificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
final Notification notifyDetails = new Notification(R.drawable.chat_notification,"ChatStarted",System.currentTimeMillis());
notifyDetails.flags |= Notification.FLAG_ONGOING_EVENT;
Context context = getApplicationContext();
CharSequence contentTitle = "Chat";
CharSequence contentText = "Press to return to chat";
Intent notifyIntent = new Intent(context, Chat.class);
PendingIntent intent = PendingIntent.getActivity(Chat.this, 0;
notifyIntent, android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
notifyDetails.setLatestEventInfo(context, contentTitle, contentText, intent);
mNotificationManager.notify(SIMPLE_NOTFICATION_ID, notifyDetails);
CookieSyncManager.createInstance(this);
CookieSyncManager.getInstance().startSync();
webview = (WebView) findViewById(R.id.webviewchat);
webview.setWebViewClient(new chatClient());
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setPluginsEnabled(true);
webview.loadUrl("http://google.com");
progressBar = ProgressDialog.show(Chat.this, "", "Loading Chat...");
}
private class chatClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Log.i(TAG, "Processing webview url click...");
view.loadUrl(url);
return true;
} public void onPageFinished(WebView view, String url) {
Log.i(TAG, "Finished loading URL: " +url);
if (progressBar.isShowing()) {
progressBar.dismiss();
} } }
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK) && webview.canGoBack()) {
webview.goBack();
return true;
} return super.onKeyDown(keyCode, event);
} @Override
public boolean onCreateOptionsMenu (Menu menu) {
super.onCreateOptionsMenu(menu);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.chatmenu, menu);
return true;
} @Override
public boolean onOptionsItemSelected (MenuItem item) {
switch (item.getItemId()) {
case R.id.home:
Intent a = new Intent(this, Home.class);
startActivity(a);
return true;
case R.id.closechat: mNotificationManager.cancel(SIMPLE_NOTFICATION_ID);Intent v = new Intent(this, Home.class);
startActivity(v);
return true;
} return false;
} public void onStop() { super.onStop();
CookieSyncManager.getInstance().sync();
FlurryAgent.onEndSession(this);
} } @Commonsware

Just to be sure I have it correct, is this what you were suggesting? I was a little worried about this line:
PendingIntent.getActivity(Chat.this, 0, notifyIntent, SIMPLE_NOTFICATION_ID);
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(R.layout.chat);
mNotificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
final Notification notifyDetails = new Notification(R.drawable.chat_notification,"ChatStarted",System.currentTimeMillis());
notifyDetails.flags |= Notification.FLAG_ONGOING_EVENT;
Context context = getApplicationContext();
CharSequence contentTitle = "Chat";
CharSequence contentText = "Press to return to chat";
Intent notifyIntent = new Intent(context, Chat.class);
PendingIntent intent =
PendingIntent.getActivity(Chat.this, 0, notifyIntent, SIMPLE_NOTFICATION_ID);
notifyDetails.setLatestEventInfo(context, contentTitle, contentText, intent);
notifyIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
mNotificationManager.notify(SIMPLE_NOTFICATION_ID, notifyDetails);
CookieSyncManager.createInstance(this);
CookieSyncManager.getInstance().startSync();
webview = (WebView) findViewById(R.id.webviewchat);
webview.setWebViewClient(new chatClient());
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setPluginsEnabled(true);
webview.loadUrl("http://google.com");
progressBar = ProgressDialog.show(Chat.this, "", "Loading Chat...");
}

View 1 Replies View Related

Android : Purpose Of Using Intent.createChooser() In StartActivity()?

Sep 27, 2010

When ever we need to send an email in Android we will invoke registered email application using Intent.ACTION_SEND. like the below

Intent i = new Intent(Intent.ACTION_SEND);

startActivity(Intent.createChooser(i, "Send mail..."));

My doubt is why do we need to use Intent.createChooser in startActivity rather than using
startActivty(i).

Is there any specific reason of using Intent.createChooser()?

View 1 Replies View Related

Android : StartActivity Intent Fails When Certain Apps Are Running

Jan 27, 2010

I am running into a critical conflict of sorts. My app is a remote service which essentially starts an activity when the screen goes to sleep. How it does this is very simple via screen off broadcast receiver and then an explicit intent to start the activity as a new task. The activity is basically in charge of responding to key events and displaying some simple text.

Thanks to a few window flags added in 2.0, activities can do this. They can be created in a way that either puts them on top of the lockscreen, or completely dismiss the lockscreen. This way they basically have focus without the lockscreen having to be dismissed by user. The alarm clock in 2.0 uses the flags to wake up the device and show the alarm dialog. I use them to place my activity when the screen sleeps so the user sees a custom wakeup lockscreen. The reason we create it at screen off is to get rid of lag the user experiences at wakeup involving first seeing the lockscreen, then seeing the activity appear. Also doing it immediately at sleep allows it to have focus so it can handle key events effectively.

The process works perfectly except in certain apps. So far, it seems the bug is consistent while browser (and even dolphin browser) as well as the facebook app are running. The bug never happens in GTalk or Launcher. It is rare but can still be duplicated in the messaging app every so often. I can't figure out why my activity doesn't get created at sleep while these apps are active. My remote service still gets the screen off broadcast and does the startActivity for the explicit intent, and that's all I get in the log. My onCreate is not being called. Instead it gets called when we wake the screen up again.

I have tried, as a control, to hold the partial wakelock starting when my remote service gets created, and the issue persists. So I don't believe it is a problem that the CPU has gone to sleep. Since only these particular apps cause the issue to duplicate, I can't imagine why the activity start fails. What could those apps be doing to interfere with another app's ability to get created? I use singleInstance as the launch mode so that I can ensure that the activity will never be able to be recalled by user process. I want it to go away when user unlocks and it is working fine like this, as long as it is able to be created. The singleInstance ensures I can have the same lockscreen handle an intent to do something specific based on user actions that the remote service monitors.

my source code can be viewed on my project page. http://code.google.com/p/mylockforandroid/source/browse/#svn/trunk/myLock/src/i4nc4mp/myLock

The issue happens to both my CustomLockService and NoLockService variations. These two services will start Lockscreen or ShowWhenLockedActivity and the bug is witnessed. The build illustrating the bug's end result-- user has to try to unlock 3 times due to the bug because on wakeup when the oncreate finally succeeds, user is seeing the activity when normally it would have auto-dismissed thanks to key event logic that also isn't seeming to happen due to the delayed onCreate, so they have to send it to sleep again. Now that the activity is properly done being started, and screen is asleep, the expected functionality happens at next wakeup-- can be downloaded also from the downloads tab.

This seems like an extremely irrational thing to be caused only by specific apps. I am quite baffled and out of ideas for a solution unless I've made some critical mistake in my activity definitions.

View 1 Replies View Related

Android :: Start An Activity In Different Apk Using StartActivity - Using The Activity Name Or Similar

Apr 20, 2010

I have tried to write an Android application with an activity that should be launched from a different application. It is not a content provider, just an app with a gui that should not be listed among the installed applications. I have tried the code examples here and it seems to be quite easy to launch existing providers and so on, but I fail to figure out how to just write a "hidden" app and launch it from a different one.

The basic use case is:

App A is a normal apk launchable from the application list.

App B is a different apk with known package and activity names, but is is not visible or launchable from the application list.

App A launches app B using the package and class names (or perhaps a URI constructed from these?).

I fail in the third step. Is it possible to do this?

View 3 Replies View Related

Android :: Pause N Resume The Activity?

Jan 20, 2009

How to pause and resume the activity?

View 3 Replies View Related

Android :: Launching Correct Activity On Resume

Jan 22, 2010

I'm currently working with a two-activity application. The first activity allows the user to choose options for their upload, and the second activity displays a ListView of their results once processed.I have code in place that performs the uploads/downloads in the background, regardless of whether the application is currently in focus or not (thanks to Matthias Kaeppler's Droid-Fu).I would like to have my application Resume into my second (results) activity when a user clicks on the icon from the top-level launcher, regardless of how long they have been away from the app. I thought that the 'alwaysRetainTaskState' flag in the Manifest would do it, but I've not had success with that. Can anyone tell me how I need to set up my Manifest to get this functionality?

View 19 Replies View Related

Android :: OnPause() - Resume To An Activity Which Has A Bundle Passed To It When Created

Mar 11, 2010

I have an application where I navigate from Activity A to Activity B and back to A and then B. I want to resume the activity B (which has a Bundle passed to it ) from Activity A. The documentation says that OnSaveInstance() is called only when the activity is killed, so how do i use OnPause which does not have the Bundle to resume the activity B.

View 13 Replies View Related

Android :: Calling StartActivity From Outside Of An Activity

Dec 7, 2009

I have a TabActivity subclass that attempts to start a new activity via a menu item selection in onOptionsItemSelected.I am receiving the following exception which eludes me at the moment.I'm not sure why it thinks I am *not* in an activity!

View 2 Replies View Related

Android :: Activity Events On StartActivity

Sep 28, 2010

Is there any event triggered on an activity when I call startActivity("activity_id", myIntent);

If the Activity exists already. I pass a parameter to the activity via i.putExtra("someID", someSerializableObject ); and would like to call a method to refresh a WebView. Right now, the call on startActivity brings the activity in the foreground but the webview does not display what i want.

View 1 Replies View Related

Android :: Calling StartActivity From Outside Of An Activity - Getting Error

Sep 11, 2010

I'm using an AlarmManager to trigger an intent that broadcasts a signal. The following is my code:

CODE:................

I'm calling this code from an activity, so I don't know how I could be getting the following error...

CODE:....................

Is this really what you want?

View 1 Replies View Related

Android :: Calling StartActivity From Outside Of An Activity Context

Oct 12, 2010

I have implemented a ListView in my Android application.

I bind to this ListView using a custom subclass of the ArrayAdapter class. Inside the overridden ArrayAdapter.getView(...) method, I assign an OnClickListener. In the onClick(View v) method of the OnClickListener, I want to launch a new activity.

I get the exception:

Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?

How can I get the context that the ListView (the current Activity) is working under?

View 2 Replies View Related

Android :: Resume Activity And Play Audio File After Spawned Thread Completes Download?

Jan 13, 2010

I've got an activity that calls a helper class called DownloadManager. DownloadManager spawns a thread that downloads a mp3 to the sdcard. I'm having some trouble finding the best design for resuming the initial activity and starting the MediaPlayer. Does it make the most sense to use a BroadcastReceiver that receives a message that download is complete, then start a new Intent of my activity? Think I saw something that I can't use an Intent to start an Activity from BroadcastReceiver because it is a background process.

View 4 Replies View Related

Android :: Calling StartActivity From Outside Of An Activity Context Requires The Flag_activity_new_task Flag

Sep 21, 2010

I tried to create a edittextbox, and button next to it, in the status bar.! I created it and tried to launch the browser activity, when somebody enters a URL in the textbox & click that button.

I get runtime exception as below.Can anyone please help what is the issue with this exception ? I know that Status bar is not a seperate activity. It is part of 'PhoneWindow'.

CODE:.............................

View 7 Replies View Related

Android :: Open Dialogue Activity Without Opening Main Activity Behind It

Jul 19, 2010

Im writing a program that offers a quick reply dialog upon receipt of an SMS.

However, I am getting an unexpected result. When I receieve an SMS, the appropriate dialog activity comes up displaying the correct phone number and message, however there is a second activity behind it that is the 'default' activity in my program (it is what opens when i launch my application)

I do not want this second activity to come up. The quick reply activity should come up by itself over top of whatever the user was doing before.

The 'floating' activity:

CODE:.........

The call to the activity inside an onReceive()

CODE:..............

The Manifest:

CODE:.................

View 1 Replies View Related

Android :: Passing Arguments From Loading Activity To Main Activity

May 16, 2010

I'm writing an application that starts with a loading activity. In the loading activity the app requests html from web and parses the html, then it sends the parsing result to the main activity. The main activity has several tabs, and contents of these tabs are based on the result of parsing.For example, the result of parsing is a list of strings ["apple", "banana", "orange"], and I need to pass this list to main activity, so that the main activity can create three tabs named after three fruits.I would like to know if there is any way to pass a list of strings among activities, BTW, is it the common way of do this?

View 2 Replies View Related

Android :: Start Activity When Main Activity Is Running In Background

Jan 10, 2010

I created an application which enables the user to set whether he wants to receive notification while the application runs in background mode. If the notifications are enabled an activity should be started (the dialog should appear on the screen).

I tried to enabled it the following way:

CODE:...........

This is the method from main activity. When onPause() is executed isRunningInBackground is set true.
When I tried to debug it when the main application was running in the background the line

startActivity(intent) had no effect (the activity didn't appear).

Does anyone know how to midify the logic in order to start an activity from the main activity when the main activity is running in the background (after onPause() is called)?

View 1 Replies View Related

Android :: Starting Second Activity From Main Activity On Button Click

Dec 4, 2009

Need an example of how to create/start a new activity from the main activity. I have a button click event on the main layout. Originally I just used setContentView(R.layout.secondactivity); which brings up the layout but I don't think that is correct since the secondactivity class is not instantiated at this point yet. I have looked for such an example and can not find one.

View 3 Replies View Related

Android :: App Widget Configure Activity Opens Main Activity

Jan 10, 2010

I hav an app that is like a relational database. There is a main app activity that users manage things with. There is also a widget that will display important info and add data to the database. When the widget is clicked, a configure class displays a way for the user to edit data. When the configure activity is done, the widget is updated and instead of going back to the home screen, the apps main activity is started. I can't find where the main activity is being called from. Wouldn't I have to create an intent and start Activity() to get this behavior? When done updating, I want the home screen and not my app.

View 3 Replies View Related

Android :: Main Activity To Browser Activity Error

Nov 7, 2010

I have a main activity, then i call a new activity intent from this. Lets call this SecondActivity. Then from my secont activity i call a browser intent. Then my browser intent call my second activity's onNewIntent method.Evereything work fine, but when i click on "back" button on my phone on my second activity, i will not going to my main activity, but the browsers activity, why?

View 1 Replies View Related

Android :: Getting An Asset Outside Of Main Activity

Nov 30, 2009

From digging around a bit, getAssets() is an inherited method from ContextWrapper. It returns an AssetManager, and using open() it can return an InputStream. What I'm attempting to do at this point, is use the GLSurfuceViewActivity, Cube and CubeRenderer to work and learn off of and read in vertex data from a binary file. I've already created the binary output by parsing a model obj file and added to the assets directory. My Shape class (modified from the Cube class) does not have access to calling getAssets() since it's not a subclass of Activity or ContextWrapper. Once I accepted that, I tried to think of the best way to read in the data (without storing it extra places) to the Shape class. What I did, and seems to be working okay, was modify the Shape and ShapeRenderer constructors to accept an AssetManger as a parameter.

View 3 Replies View Related

Android :: Application Without Main Activity?

Oct 5, 2010

Is there a way to manage application activities by hand, like this: user activating an application from menu, it does some initialization, then creates some activity (is it necessar y to declare all activities in the application manifest?), and listens to it's events. On some event application decides to close one activity and open another - so it contains all the application logic. Didn't found anything like this in examples, they all have all the logic in the activity classes. Maybe I need to user Services? (Maybe I don't understand right, what an activity represents. For me it's like window in windows, or Displayable in j2me) I'm very new to android development, trying to understand the basics.

View 4 Replies View Related

Android :: How To Tab In Activity To Display Main.xml?

Apr 6, 2010

I am trying to make a app with the tuotrail of the developerspage, then I would like to display a main.xml in a tabview, instead the textview, wich in the tuotrail,is in the activity.How do I tell my tab in activity do display the main.xml?

View 1 Replies View Related

Android :: Service Updating Main Activity Gui

Aug 24, 2010

I have a service which collect data and send them to a certain URL and updating the main activity GUI, so which is better in the performance to use a long service with listeners to collect the data and threads in it to update the GUI and sends to the internet or to make another service responsible for updating the GUI and sending to the URL only while the first one just collects the data?

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved