Android :: Sending Data Back To Main Activity?

May 28, 2009

I have two activity Main activity and child activity when I press a button the child activity is lunched. Still now I have no problem. I want to send some data back to the main screen. I used The Bundle class but it is not working. It throw some run time exception.

Android :: Sending Data Back to Main Activity?


Android :: Sending Data Back And Forth Between Activity And Service Locally?

Aug 13, 2010

I am a bit new to Android. What I need to do is send data back and forth between an activity and a service locally. The information sent is sensitive and must not be able to be picked up by other apps. This excludes using broadcast and the onBind() function if I understand things correctly? So the activity needs to send some string parameters to the service. Also it somehow needs to tell the service which activity started it so the service can reply to the correct class since many different activities will use this service.

Once the service has fetched the information via a http request it is suppose to send that data (just a long string which will later be parsed) back to the activity that started it. How do I go about doing this? Using static variables/functions is not an option since again many actives will be using this service. Sure it would be possible to use a static array to hold the classes but that just seems ugly. It's only possible to send simple variables (not objects) via the intent? There must be a better way to do this.

View 1 Replies View Related

Android :: How To Come Back Main Activity From Child One?

Mar 30, 2010

I'm in a small problem.i have three activities (suppose A,B,C) after performing onclick event in activity A, i can go to activity B and then C..my question is that is there any way to comeback activity A from C..here is the code snippet public void on Create(Bundle Code...

View 3 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 :: Pressing Home Or Back Buttons From Main Activity / Causes App To Stop Unexpectedly

Nov 13, 2010

This is difficult for me to diagnose because the Log doesn't provide the offending code line that indicates what caused it.Running the app in the Emulator seems to work OK until I press Home or Back from the Main Activity. Using Back between the activities in the program seems to work OK, it only fails at the Main. I don't have the app finished yet so I haven't loaded it to a device yet.The Log says there was a null pointer exception so I would like to find why.The log points to the android routines (and I don't appear to have the source for those routines in the emulator-most but not all and these are refering to those I can't access). The log gives up at one point and says "11 more".It would be nice to see the remaining 11 in the hopes that one of them points to the line in my code that caused the offense.I'm looking for ideas on ways to find the error and hopefully cure it.

View 2 Replies View Related

Android :: Sending Data From Service To Activity

Sep 23, 2009

I am having issue for sending data from service to Activity through notification , I click a notification a activity get invoked but when i try to add some parameters through bundle i am not able to get the parameters in that called intent , I have gone through the link
http://stackoverflow.com/questions/1198558/how-to-send-parameters-from-a-notification-click-to-an-activity. but still no luck has any body occurred with the same issue.

View 1 Replies View Related

Android :: Use Of Intents Used For Sending Data To Activity From Service

Feb 16, 2010

I am little confused with the use of intents used for sending data to activity from service. In my application I have to have startactivity from the service and have to pass data ,so that activity can utilize the data while launching.For this i have written the following code Intent intent = new Intent(Service.this,Activity.class); intent.putExtra("data", data); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.start Activity(); I assume that the data is passed to the activity and can be parsed on the oncreate function of the activity.Now the service running in the background has to pass data to the activity continously for UI updates.For this I have written the following codeIntent intent = new Intent(Service.this, Activity.class); intent.putExtra("Data", data); intent.setAction(Intent.ACTION_ATTACH_DATA); sendBroadcast(intent,null); (Do I need to broadcast the intent???) In activity I have done following things:- Implemented broadcast reciever:private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (Intent.ACTION_ATTACH_DATA.equals(intent.getAction())) { Bundle extra = intent.getExtras(); float Data[] = extra.getFloatArray("Data"); update(Data);

View 4 Replies View Related

Android :: Starting An Activity By Sending An Internet With Extra Data

Feb 19, 2009

I have a newbie question which is puzzling me regarding using Intents to start a new Activity but passing some data with the Intent for the new Activity to use. My app has (say) MainActivity from which I want to launch a second activity, SecondActivity, within the same app, whilst I pass an integer parameter to SecondActivity. Now my problem is : how do I receive the Intent when SecondActivity gets started and recover the value of the integer parameter ? Which member function of.

View 3 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 :: Activity Which Downloads Data In Background With Service - Doesn't Get Destroyed On Hitting Back Button

Nov 9, 2010

I need to develop an application with downloads the data at the background and update about the progress in the front.

I guess this can be achieved using services and activity and passing data in between the. But, what I need to do is even if I hit back button and then start the activity again. It should check if the service is running or not. If service is not running it should start one else it should display the data from running service.

Something like music player where music is played by a service at a background and activity displays the information. Even on browsing through other activities of the application or hitting back, state of the music player is maintained.

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 : Back Button - Go Main Page From View

Dec 11, 2009

Am creating a small application In View Page am doing update and delete operation from database am displaying data s in the top (ex 10 records) and bottom i have 2 buttons Edit and delete if user clicks Edit button it redirects to Edit page In Edit page i am displaying content for editing also i have 2 buttons update and cancel if user click update again am redirecting(using start activity) to view page It is not displaying new records. i went back to main page and then i clicked view page now it is updated How to solve this ??? Another problem is At the same if user clicks back button it is going all page which i went (through redirected page)

For example First i clicked view page from main page in view page am doing edit and delete operation after completing this it goes to view page Here i am clicking back button it is going previous page that is edit or delete page which i have performed last I need to go main page from view (after performing edit or delete op) How to do this ?

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

Android :: Service Bound To Main Activity

Nov 11, 2010

so the application I've written has a service (that tracks GPS data) with a single main activity that binds to it with bindService in it's onStart() method, and unbinds from the service in it's onStop() method using unbindService( ServiceConnection ). I also have an activity which is an options screen, that is launched by pressing a button on the main activity. On this options screen, I have a checkbox that says "Run in background", which, if set to true, means that when the user exits the application with eier the Home or Back buttons, the service will continue running, not turning the GPS off. I do this by calling this.startForeground onUnbind, and this.stopForeground onRebind, if the setting is set to true, and stopping and starting my location reader onUnbind and onRebind respectively if the setting is false. If the service is running in the background, it also displays a notification to ensure the user understands that the GPS is still running and draining their power. This notification is displayed and stopped by relying on the startForeground and stopForeground methods......

View 1 Replies View Related

Android :: What Is Recommend Way To Get Main Activity From Child One?

Mar 29, 2010

My android application has 1 main activity. And it launches some sub-activity (which I wrote) and that also launches some sub-activity (which I wrote). I do this. My question is how can each of my sub-activity and sub-sub-activity get back to the Parent activity? Code...

View 2 Replies View Related

Android :: Initialize Preferences From XML In Main Activity

May 20, 2010

My problem is that when I start application and user didn't open my PreferenceActivity so when I retrieve them don't get any default values defined in my preference.xml file. Code...

View 3 Replies View Related

Android :: Push New Instance Of Main Activity?

Sep 2, 2010

Is it possible to create/push-onto-stack a new Activity of the same main Activity in an Android application with an argument passed to the Activities constructor? Specifically from a Dialog object...

View 1 Replies View Related

Android :: Email App Switch Its 'main' Activity?

Dec 4, 2009

In android Email app, when I first launch it, it will shows me the 'account setup wizard' activity. But when I launch the Email app(after the account is set) again, it wont' show the 'account setup wizard' activity, it will show the 'Folder list activity ' instead.

How can it does the main activity switch (depends on the email account setup)?

View 2 Replies View Related

Android :: Call Main Activity From BroadcastReceiver?

Oct 28, 2010

While developing an alarm based application, i have stuck in a scenario.

When my alarm is fired, i can receive the event in BroadCastReceiver::onReceive().
Within this function, i want to notify/call a function, which is located on MainActivity.

How to achieve the same?

View 1 Replies View Related

Android : How Can I Change Main / Launch Activity?

Jul 13, 2010

I think I already know the answer to this, but I just wanted to confirm (I think no horrible ramifications)...

View 5 Replies View Related

Android : Can App's Main Activity Be Bypassed On Launch?

May 9, 2010

Are there any scenarios on Android where a process can be instantiated (classes loaded, etc.) and a non-main activity launched without going through the main activity? Background: my app has a single main activity (android:name="android.intent.action.MAIN" and android:name="android.intent.category.LAUNCHER"), some secondary activities, and a preferences class providing static methods meant to be called from anywhere. These static methods' implementations require a Context, and so the class has a static Context member s_context; the static methods assert that s_context is non-null before using it. The very first thing I do in my main activity's onCreate() method is pass getApplicationContext() into the preferences class so it can set s_context.

View 2 Replies View Related

Android : Get Screen Dimensions In Main Activity?

Jun 19, 2009

I created some custom elements and I want to programatically place them to the upper right corner (n pixels from the top edge and m pixels from the right edge) therefore I need to get the screen width and screen height and then set position:

int px = screenWidth - m;
int py = screenWidth - n;

Does anyone know how to get screenWidth and screenHeight in the main Activity?

View 3 Replies View Related

Android : How To Read An Asset From Outside Of Main Activity

Nov 8, 2010

I need to be able to be able to call readAsset from outside of the main activity of my application. I have heard people mention needing to pass the Context around, but the language has been very vague. Can someone describe the steps necessary to add the ability to call readAsset to an existing class that is not the main activity? Creating a public function in the main activity and having others call that will not work as the place I need to add readAsset to, is in a separate thread.

View 1 Replies View Related







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