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.

Android :: starting second activity from main activity on button click


Android :: Widget Starting Service Also Starts Main Activity

May 3, 2010

I have a widget that is supposed to start and stop a service (start it when it's not running, stop it when it is). This is working fine, however, each time the service is started, my app's main activity is also launched, which I don't want from the app's manifest, it works as I want it to (without launching the main-activity, just the service), but then I obviously don't have a main activity anymore.This is how I start the service (I would assume this is the normal way, and I can't see any reference to what might cause the MAIN intent to fire).

View 1 Replies View Related

Android :: Phone Starting New Activity When Screen Off Button Pressed

Aug 13, 2010

We are experiencing this strange problem. If I press screen off button When my activity is running, its again starting a new activity. If I press the screen off button again and unlock the phone, it again starts a new activity. So in total there are 2 new activities getting created for one screen off and on.

View 5 Replies View Related

Android : Way To Switch Over To Next Screen From Main Activity By Clicking On Button?

Nov 18, 2010

I am working on an application where I need to go to the next Screen form the Main Actvity when I Click on the Image Button of the Main Activity Screen. I had searched a bit on Net regarding this and found something like the OnClickListener method. I am still stuck for what exactly I want to do actually.

View 3 Replies View Related

Android :: View An Activity On Button Click

Jun 30, 2010

I want to show the details of a list item in another activity when clicks on a button.Can you help me?

View 2 Replies View Related

Android :: Start A New Activity When Click On Button?

Nov 15, 2010

In android application , how to start a new activity (GUI) when click on a button on another activity , and how to pass data between these two activities?

View 3 Replies View Related

Android :: Optimal Activity Stack Order For A Main Menu Button?

Jun 2, 2010

I'm developing an app that starts with a main menu, and then continues through three different steps (activities) to a final activity where the task is marked complete. On this last activity, i have several additional options (add note, share, etc..) and i also have a return to main menu button.

My question is.. how do i stack the activities so that calling finish() on the final activity will return back to the first activity launched? i am currently just starting the new activity via an intent, so pressing back on this screen doesn't return me to home as i would like.

View 2 Replies View Related

Android :: Main Activity Grayed-out / Disabled On Back Button - Cause This Problem?

Jun 25, 2010

I have a problem on going back (clicking the Back button) from sub-activity to main activity: from my main activity I launch a new one (with passing some extras). code...

In the started activity I am getting data from extras and showing, etc. So everything works very well until I click Back button to return back to main activity. Then main activity appears but directly after - grays-out. I can't do anything there anymore... This "grayed-out" style looks something like there should be a dialog displayed, but there is no dialog shown, just the whole activity is pushed down/disabled instead...

One another interesting thing I noticed - that activity is still alive in background, because if I click "Search" button the Quick Search Box appears on top of my activity and if I click Back button then (to cancel it) - it disappears and my activity then becomes fully functional again (gray-out effect simply disappears...)

Tried watching logcat, but it shows nothing useful, no exceptions thrown, just this text always comes up:

W/KeyCharacterMap( 564): No keyboard for id 0
W/KeyCharacterMap( 564): Using default keymap: /system/usr/keychars/qwerty.kcm.bin

What could cause this problem?

View 1 Replies View Related

Android :: Moving Back To First Activity On Button Click

May 5, 2010

I am writing a application where I am dealing with 4 activities, let's say A, B, C & D. Activity A invokes B, B invokes C, C invokes D. On each of the activity, I have a button called "home" button. When user clicks on home button in any of the B, C, D activities, application should go back to A activity screen ?

How to simulate "home" button in this case ?

View 1 Replies View Related

Android :: Change Activity In Tabs On Button Click?

Nov 20, 2010

I am creating an android application in which uses tabs. There are three tabs which runs different activities. Activity which runs tab 1, has a button. I want to change content of Tab 1 by clicking on that button. But If I call another activity it doesn't start in tab1 but replaces tab.

View 5 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 :: 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 :: Pass Value Back To Same Activity On Button Click And Refresh Page?

Jan 21, 2010

I need to pass a value back to the same activity and refresh the activity to generate new data. Can anyone please provide me some ideas/guidance on how to do it?
I had try using intent to call the same activity but it doesn't work. Here is the code which i tried to use intent code...

View 1 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 :: Starting Map Activity From Normal Activity

Apr 25, 2010

I have a map app which works fine when its stand alone but it causes an unexpected error when I try to add it as part of another app. My current app which extends Activity tries to launch the map activity with the following lines of code Intent m = new Intent(this, HomeSetter.class); startActivity(m); I also have the xml setup correctly <activity android:name=".HomeSetter" android:label="Screen 4"> </activity> <uses-library android:name="com.google.android.maps" /> </application> However when I try to launch it crashes everytime. I've tried searching the net but I've had no joy in finding a solution You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscribe @googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

View 4 Replies View Related

Android :: Starting Activity Behind Current Activity

Oct 2, 2009

startActivity() displays the new Activity on top of the current one. But how to display it underneath instead? BTW, I'm starting an Activity from another application, if that makes a difference.

View 5 Replies View Related

Android :: Starting New Activity From Activity

Jun 9, 2010

When I was originally learning about Android a few months ago I swear I read something about a way to immediately launch an activity when starting a task. I am curious about this now because I need to display an intro screen on launch but I don't want the intro screen to be the root activity. Does anyone know if there is something like this and if not what is the best way to handle an intro screen?I tried googling for a few hours to find it but can't for the life of me.

View 1 Replies View Related

Android :: Starting Activity With FLAG ACTIVITY MULTIPLE TASK To See Multiple Instances

Feb 2, 2009

I am trying to launch an activity from another activity .. Within the com.android.SingleLauncher..

I have activity launch code as ..

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

I have set the android:multiprocess="true" in the AndroidManifest.xml of TargetSL I don't seem to see the multiple instances of TargetSL, which i am expecting ..

All i see is 2 process, where i was hoping to see an instance of TargetSL, for each launch that was invoked by the singleLauncher!

View 3 Replies View Related

Android : Way Return To Main Menu In Droid By A Button Click?

Nov 22, 2010

In android, my app provides a button that the user can click to return them back to the screen that appears when the app is opened (onCreate). How can I set that button to return the user to the main menu?

View 2 Replies View Related

Android :: Starting Activity With Tabs

May 7, 2010

I have four activity in a Tab and after the user clicked on the list I would like to start another one activity, but I can't use startActivity(Intent), because then I lost the TabHost view, and I get an activity witch is reserving the full screen:( So the user won't be able to click on the other tabs. What should I use? BroadCastReciver or What? If anyone have any good idea please help on me.

View 4 Replies View Related

Android :: Starting Activity By Package Name

Mar 25, 2010

I have the code to get the list of packages installed in phone. I have represented the list in the form of Array List, below is the code snippet. But upon clicking in the package name I want to start that application, but how do I get the respective class name and package name to run? Is there any other method which I can try to start an application? arrayList<String> PackageNames = null; List<PackageInfo> lis = pm.getInstalled Packages(GET_MINIMAL); Pkgs = (ListView) findViewById(R.id.package_list); for (Package Info pi : lis)packages.put(pi.packageName, pi); PackageNames = new ArrayList<String> packages.keySet()); Collections.sort(PackageNames); PackageNames.add(0, "All"); pgs.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple _list_ item_1, PackageNames)); Pkgs.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View v, int pos,long rowId) { Intent i = new Intent(); i.setComponent(new ComponentName(class name,packagename)); startActivity(i); I have tried intent to start the activity, but don't know the class name and package name to pass in the ComponentName() to start activity.

View 2 Replies View Related

Android :: Error When Starting Activity

Mar 22, 2010

I'm starting an activity when a button is pressed, and normally (in other apps) haven't had an issue. But when I press the button in this app, I get an "unable to marshal value" error.Exact(ish) error from LogCat:
03-22 02:49:02.883:
WARN/System.err(252):
java.lang.RuntimeException: Parcel:
unable to marshal value
{CLASSNAME}@44dcf1b8
I feel that this might be related to the extra that I'm passing to the intent. I'm passing an ArrayList as a serializable to this new intent. My concern is that the data structure that the ArrayList contains isn't being serialized (as it's a personal data structure).Is the array list content data structure causing this? Something else that I'm missing?

View 1 Replies View Related

Android :: Starting An Activity For Different Third Party App

Aug 19, 2010

I'm working on an app and I want to integrate the Last.fm app into it. Basically, when someone is looking at an artist in my app, I would like to have a button that they can tap to open up Last.fm application with the artist's information.

This intent works, but it loads a menu asking which app I would like to use (Browser or Last.fm):

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

However, I just want to start the Last.fm app and skip the dialog asking which app to use, I thought maybe using the setPackage() method would work like this: i.setPackage("fm.last.android");


But it causes the app to crash:

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

Is it possible to just start the Last.fm app?

Here's a copy of Last.fm's AndroidManifest.xml for reference.

View 1 Replies View Related

Android :: Error When Starting A Tab Activity?

May 16, 2010

I followed the directions verbatim in this Android tutorial, copying/pasting the code from the site to my app. http://developer.android.com/resources/tutorials/views/hello-tabwidget.html

However, when I try to run in the Android emulator, I get the error: "The application Hello Tab Widget has stopped unexpectedly. Please try again."

I tried debugging by introducing a breakpoint in the first line of the onCreate method, but the error occurs before the breakpoint is even hit. Any idea of what is going wrong, or any other way I can debug this issue? I am using Eclipse.

View 2 Replies View Related

Android :: Tabs - Starting A New Activity

Dec 31, 2009

I have 4 Tabs in a TabHost...let them be A,B,C,D.... now each one is just an index page and clicking on any of them shows a different activity...

The problem is that i need to start another activity wen user selects something from the content displayed in the tab... The other activity should also be displayed in the parent tab itself... is it by any chance possible or i'll have to try some other way around?

View 2 Replies View Related

Android :: Starting An Activity In OnStart

Apr 14, 2010

I'm trying to start a floating activity from onStart to retrieve some info from the user right when the initial activity begins.

I have the following:

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

And callProfileDialog() is just:

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

ProfileDialog.class returns a String from an input box. If the result returned is RESULT_CANCELED then I restart the activity.

The problem I'm having is that when the program starts, the screen is just black. If I hit the Back button a RESULT_CANCELED is returned then the initial activity shows as well as the floating activity (since it recalled itself when it got a RESULT_CANCELED). Why can't I get the activities show by calling ProfileDialog.class from onStart()? I got the same result when I called it at the end of onCreate() which is way I switch over to use onStart().

I have also tried the following:

CODE:.........

But this doesn't work either. It all works fine once I hit the back button but without doing that, it's all black.

View 3 Replies View Related

Android :: OnRecieve Starting Activity?

Jun 23, 2009

I would like to know the reason behind this behaviour.I have a broadcast reciever and in onrecieve i am trying to start an activity,however if i am not giving the flags it is giving an exception .On declaring the flags it is working perfectly fine,why?

I was under the impression that onRecieve runs in the main UI thread and we can launch an activity in onRecieve.Error given by the emulator is self explanatory but still why do i need to create an activity in a new task(only in onRecieve)?

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

View 4 Replies View Related

Android :: Name Of Droid App Taken As Of Starting Activity / Why Is This?

Oct 18, 2010

In my manifest file, I have given the application name as MyApp and the name of the starting activity as Main Menu.code...

When I see the app icon in the default menu screen of android, the name shown is Main Menu. Why is MyApp not the name shown for the app?

View 2 Replies View Related







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