Android :: Why Isn't Bundle Getting Passed?
May 11, 2010I'm trying to pass a bundle of two values from a started class to my landnav app, but according to the debug nothing is getting passed, does anyone have any ideas why?
View 1 RepliesI'm trying to pass a bundle of two values from a started class to my landnav app, but according to the debug nothing is getting passed, does anyone have any ideas why?
View 1 RepliesI 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 RelatedI was wondering if there is a way to determine who passed an intent to my application. For example, I have a service, that I want to act differently depending on who passed the intent (for security reasons). I'm trying to sandbox each calling application, so they only have access to their data stored in my application.
For it to be secure, I cannot trust any application to be truthful about the identifying data it is passing into my service. Therefore, I need some system way of identifying who sent the intent in a way that the calling application cannot change that information. I don't know if it is possible, but I can't find anything in the Intent class, and I was wondering if there may be another structure which does what I want it to. If it is not possible, I would like to get some type of mechanism to do this in the roadmap.
I want to receive a data which is passed using intent from another page.
View 1 Replies View RelatedAs asked, is it possible? Here's part of my code. I don't know how to change it.
CODE:............
And yes, the error toast came up!
When we want to pass data from an activity to a sub activity we use the is there any event handler that handles this?
View 1 Replies View RelatedI am writing a music player for esoteric music formats, and have defined mime types for them in my Manifest.
However, the standard music player is always started even though it can't handle the format. Looking at logcat I see;
: D/MediaScannerService( 688): IMediaScannerService.scanFile: / sdcard/download/Cybernoid.sid mimeType: audio/prs.sid : I/ActivityManager( 578): Stopping service: com.android.providers.media/.MediaScannerService : I/ActivityManager( 578): Starting activity: Intent { action=android.intent.action.VIEW data=file:///sdcard/download/ Cybernoid.sid type=audio/prs.sid flags=0x4000000 comp={com.android.music/com.android.music.MediaPlaybackActivity} }
.. so it seems the component is explicitly set to the music player ? Is there any way around this ?
Why below code is throwing nullPointer exception in last line (when accessing javaInterface.mValue) This line through NullPointer, so basically it is not being set. even though the javascript is correct and has been verified using FireBug that it returns expected string.
There are few lines above this code chunk but it is irrelevant this problem
CODE:................
I have an activity that implements LocationListener in my application and my onLocationChanged method has been working perfectly up until recently. For some reason the Location object being passed into the method is null. My question is, why is it null? Does it pass in a null object if it cannot acquire a location?
My GPS is on and I have it set to pull a location from the GPS, and I know my GPS can get a fix on me as I used Maps and had it locate me.
Also, I have the permission for my app set as:
CODE:.................
I don't believe permissions is the issue though, as my activity was working beforehand and I have not altered the permissions since then.
Here is the code that determines the provider of the location object:
CODE:.............
Here is the LogCat output of the error:
CODE:..............
I have tested the same code on another device (an HTC MyTouch 3G to be precise) and it works flawlessly with the GPS, however on my Motorola Droid it crashes.
This subject originates here: http://groups.google.com/group/android-beginners/browse_thread/thread...
To sum up:
When I click on an item in the ListView, the background color that gets changed is not that of the clicked item but instead of the other item in the opposite side relative to the middle item:
1 <-- I click here 2 3 <-- Acts as a mirror 4 5 <-- This is the one that gets changed
1 2 <-- This is the one that gets changed 3 <-- Acts as a mirror 4 <-- I click here 5
This problem persists even when I use CheckedTextView like what is suggested in the post.
I use the latest stable SDK.
This problem occurs when the target platform is Android 1.6, 2.0 or 2.0.1.
The problem does not occur when the target platform is Android 1.1 or 1.5.
However, the problem will also occur when the program is compiled for 1.5 and run in 2.0.1.
The simple problematic code can be found here: [url]
There I also put the screenshots showing the problem: demo01.png: I click an item. demo02.png: the clicked item doesn't get changed but the reflective item does.
Is this a bug in newer Android platforms?
If it is intended, what is the reason and could you please show me how I should fix my code?
Is there a way to scale the Drawable passed to TextView.setCompoundDrawables ? The following code works very well but of course is set to the full intrinsic size of the drawable. This code is used with the Holder pattern in a ListView where the purpose is to update the drawable without two more Views (LinearLayout and ImageView) to accomplish the same thing. code...
I suppose I can use Drawable.setBounds() and preserve the original aspect ratio with a small function but just wondering if there this a more direct way to do this with the api?
Key Events that occurred in the virtual keyboard can be passed to the hardware, andriod OS or high-level focus view? As with a physical keyboard.
The dpad right event using Bluetooth devices, then it takes my keyboard service would like to pass on Android system or highest focus view(ex. system dialog, menu...etc). but I don't know how.
I have a service that regularly queries a web server for new messages. The service stores the new messages in an arrayList. These messages are implemented using a custom class, storing all kinds of metadata (strings and longs).
An activity then connects to this service to retrieve those messages and display them to the user.
I have an .aidl file that describes the interface that the service exposes.
CODE:..........
The Message class extends the Parcelable class which should allow for the IPC transfer.
The problem is this: Eclipse gives me an error saying that the type of List<Message> is unknown. Any imports are marked as invalid.
Is it possible to use bundle and save the data in OnPause() lifecycle method? The scenario is i have 2 edit text and have entered some data i want to retain the data when the activity is killed and started again. his can be achieved using onSaveInstanceState() but as documentation says, this method is not a lifecycle method and hence the callback is not guaranteed. So i wanted to know if there is a way to save it using Bundle in onPause().
View 5 Replies View RelatedI'm well aware of onSaveInstanceState(Bundle b) and the corresponding onCreate and onRestore. What I want to do is persist the bundle somewhere simple where I'll only ever have one at a time. The functionality is to be able to resume a game from its previously stored state - not to be confused with restoring the activity during its lifecycle. I want to restore it AFTER it's been destroyed (think of turning the phone on and having a button on the game that says, "resume last game". My thoughts are that if I can just persist the bundle that I normally use for the instance state, then I should be able to reload it later upon user request. I don't want to use a provider because they seem way too over the top for what I'm doing.
View 4 Replies View RelatedI'd like to serialize a Bundle object, but can't seem to find a simple way of doing it. Using Parcel doesn't seem like an option, since I want to store the serialized data to file. Any ideas on ways to do this? The reason I want this is to save and restore the state of my activity, also when it's killed by the user. I already create a Bundle with the state I want to save in onSaveInstanceState. But android only keeps this Bundle when the activity is killed by the SYSTEM. When the user kills the activity, I need to store it myself. Hence I'd like to serialize and store it to file. Of course, if you have any other way of accomplishing the same thing, I'd be thankful for that too.
View 2 Replies View RelatedI have an activity defined as:
CODE:...................
I am implementing notification handler which logs any changes in content provider and it notifies Broadcast Receiver using custom Intent on periodic basis.But problem here is from Provider to Receiver all the values passed through Bundle.
View 2 Replies View RelatedI need to pass a reference to the class that does the majority of my processing through a bundle. The problem is it has nothing to do with intents or contexts and has a large amount of non-primitive objects. How do I package the class into a parcelable/serializable and pass it to a startActivityForResult?
View 4 Replies View RelatedWhat's the correct way to pass a bundle to the activity that is being launched from the current one? Shared properties?
View 2 Replies View RelatedI have 2 dimensions array like this: public myArrayType[][] mObjArray; I want to save it in the onSaveInstanceState method, since my array contains lot of elements I don't want to save element by element but the whole array object, what is the best way?
View 4 Replies View RelatedI've gone through the Notepad Tutorials and they are all working on my virtual device. I am now stuck in the midst of trying to write my own Android app.
My setup:
Windows 7 SP 1 64-bit
Eclipse Indigo Service Release 2
Android Development Tools 16.0.1.v201112150204-238534
Android Virtual Device Platform 2.3.3, API Level 10, CPU/ABI ARM (armeabi)
The app is about as simple as they come - you enter a number, it divides it by another number and displays the result.Here is the code involved:
AndroidManifest.xml:
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.driving"
android:versionCode="1"
android:versionName="1.0" >
[code]...
By the time DrivingTimeEstimator's onCreate() method gets executed, the Bundle object (savedInstanceState) is null (which I'm guessing is what leads to mMiles being null, which throws a NullPointerException and kills everything).
While doing normal day-to-day Android development, is it safe to assume that hook methods called by the system will not pass in invalid references (ex.: null), or should I always be double-checking what arguments get passed in?For example, can the method onOptionsItemSelected(MenuItem) ever have a null MenuItem reference passed into it?The reason I ask is because I was working on the Notepad 1 tutorial,I started wondering if I should be testing if item is null before making a getItemId() method call on it, or just trust the system to not ever pass me a null?I don't want to make my code slower by doing null checks when I shouldn't be worried about that happening, etc.
View 1 Replies View RelatedMy app launches the camera to allow the user to capture a picture. Sometimes this causes the OS will kill my App to free up memory for the camera. Once the picture is taken, my app starts back up where it left off using the Bundle I saved in onSaveInstanceState(). My app had a bug where in the code that restores the state. Is there anyway that I can simulate or test this case to make sure I am restoring correctly now? It seems I am having trouble making this happen when I want to test it.
View 4 Replies View RelatedSo I have a MapActivity that runs an asynchtask that occasionally updates what exactly it's displaying on the map (via a string). I originally pass this string in from the intent when the activity is first created. And then if you click on one of the drawables on the map, it opens a new activity, which can then create a new mapview (same class) with a different string setting. The problem I have is that I only want one instance of the mapview to be running at once. Thus I set android:launchmode="singletask" in the manifest. This works in that it brings the mapactivity to the front, but is there any way to send it a new intent bundle to get a new setting for the string it needs? I tried regetting the extras from the bundle, but it seems to retain the old bundle, not the new intent that was passed to it. I'm not sure I want to do startActivityForResult because the 2nd activity may or may not want to update the original activity. I hope that made sense. I can post code if necessary, but I think that should explain my situation.
View 2 Replies View RelatedRecently tried to download Team Chaos Red Rum 1.3 on my rooted moto droid from Rom manager, after 15 min of waiting for it to boot up (freezes on motorola symbol) i battery pulled... now every time I boot it freezes in the same spot.. how do i fix? prior to boot up freezing i was runing BB 0.4 and chevy kernal @1.2 ghz
View 5 Replies View RelatedI've tried wiping app data, I won't get passed the loading screen, I've also tried un installing and reinstalling.
View 3 Replies View RelatedJust upgraded my phone firmware to 1.6, and it looks like Location objects don't have satellite counts in them any more:
locMan = (LocationManager)con.getSystemService (Context.LOCATION_SERVICE); Location loc = locMan.getLastKnownLocation (LocationManager.GPS_PROVIDER); Bundle extraBundle = loc.getExtras();
extraBundle is null. So, I can't call
extraBundle.getInt("satellites").
I am trying to use Android's LocationManager requestLocationUpdates. Everything is working until I try to extract the actual location object that in my broadcast receiver. Do I need to specifically define the "extras" to my custom intent so that the Android LocationManager before I pass it to requestLocationUpdates so it knows how to add it into the intent, or will it create the extras-bundle regardless when it passes the fired intent to the broadcast receiver?
View 1 Replies View RelatedI have an application that uses a service to create an ArrayList of custom objects (MyObject) every x seconds. I then want my Activity to obtain this ArrayList. I'm currently planning on having the Service send a message to the Activity's handler every time it finishes the query for the data. I want the message to the Handler to contain the ArrayList of MyObjects. When building the method in the Activity to get this ArrayList out of the message, I noticed that I couldn't.
View 1 Replies View Related