Android :: IllegalArgumentException Occur - Parameter Must Descendant Of View In ViewGroup.java:2454
Jul 2, 2009
I am using Android SDK 1.5. I am developing an activity with multiple content views. It will call setContentView() with different viewgroup instance for different functionality. It contains a text input dialog popped up by an option menu item. I didn't specify anything for IME in mainfest.xml & EditText attributes. I found at first, the soft keyboard for the text input dialog will overlap on the activity content view. But after several content view switch (by calling setContentView() with different ViewGroup instance), the soft keyboard will resize the activity content view. Why this inconsistent behavior happens?
...........................
View 13 Replies
Jul 20, 2010
while I'm testing my app with Monkey test tool, I ran into the following exception: "IllegalArgumentException: parameter must be a descendant of this view"
I don't really understand why this exception happens, so I did some research about this and found the following: http://groups.google.com/group/android-developers/browse_thread/threa...
According to the above post, the issue once was resolved in Donut release, but some ppl say it still happens. Is there anyone who knows anything about this issue? As far as I understood, this issue shouldn't occur unless you intendedly call the method ViewGroup.offsetDescendantRectToMyCoords to get an exception.
My app is using Tab, which means it has a lot of views in it. (including view changes too.) I don't really call setContentView repeatedly in my app though. Someone in the above post said that calling setContentView several times can cause this issue, so I just wanted to make sure that my app is not the case.
View 6 Replies
View Related
Apr 30, 2010
I have an activity that starts AsyncTask and shows progress dialog for the duration of operation. The activity is declared NOT be recreated by rotation or keyboard slide.
CODE:............
Once task completed, I dissmiss dialog, but on some phones (framework: 1.5, 1.6) such error is thrown:
CODE:...............
My code is:
CODE:................
From what I have read (http://bend-ing.blogspot.com/2008/11/properly-handle-progress-dialog-in.html) and seen in Android sources, it looks like the only possible situation to get that exception is when activity was destroyed. But as I have mentioned, I forbid activity recreation for basic events.
View 4 Replies
View Related
Jan 28, 2010
i have several gpx files on my sd card and i show them (the filename) on a listview. if i choose a gpx file, the track is load in another activity with a listview,too (adress-strings are shown). if i use the back button, the listview with the filenames is shown again and i can choose another file. but if i repeat this the third time, i get this error:.................
View 2 Replies
View Related
Apr 28, 2010
I want to create a normal AlertDialog. I used the example provided by the android dev docs. I just changed the DIALOG_PAUSED_ID to DIALOG_DELETEDB. If I execute my code and press the button which in return should create the dialog, I get the following error log:............
View 1 Replies
View Related
Jan 3, 2010
I have a ViewFlipper in my app.
When my app is running and the phone goes to sleep it works fine.
When I wake the phone up and my app then tries to display again, I get the following error.
I can't figure this out.
CODE:......................
View 2 Replies
View Related
Jun 24, 2010
I have a service running that updates a notification in the notification bar when it recieves a message saying it has to be changed.
However I get the following error sometimes when the notification is to be updated
java.lang.IllegalArgumentException: contentIntent required
Here is my code:
Variable setup
code:............
NotificationManager Creation
code:..............
Notification Creation
code:.............
Update of Notification
code:...............
So something is happening my contentIntent somewhere along the line, would that be correct?
It is declared at the top of my Service class as a member variable and is not used anywhere else in the code apart from shown above, so where could it be getting reset to null?
View 1 Replies
View Related
Apr 19, 2010
I'm building an android application, which has a list view, and in the list view, a click listener, containing an onItemClick method. So I have something like this:
public class myList extends ListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
getListView().setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
/* Do something*/
}
}
}
Normally, this works fine. However, many times I find myself needing too preform an application using the outer class as a context. thusfar, I've used: parent.getContext(); to do this, but I would like to know, is that a bad idea? I can't really call: because it's not really a subclass, just an embedded one. So is there any better way, or is that considered cosure? Also, if it is the right way, what should I do if the embedded method doesn't have a parameter to get the outside class?
View 2 Replies
View Related
Nov 25, 2009
I am trying to add a view to a viewgroup but I am getting the following error when I run the application
Error: E/AndroidRuntime( 570): java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. Code: public class ExampleApp extends ViewGroup{
private LayoutParams mLAyoutParams; AlbumArtImageView mAlbumArtThumnail;
static final String TAG = "ExampleApp";......................
View 2 Replies
View Related
Apr 23, 2010
I have the following structure defined in an xml layout file.
<RelativeLayout android:id="@+id/mainLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<FrameLayout android:id="@+id/frame" android:layout_centerInParent="true" android:layout_width="wrap_content" android:layout_height="wrap_content" ></FrameLayout>
<Button android:id="@+id/button" android:layout_below="@id/frame" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</RelativeLayout>
The FrameLayout is positioned correctly in the center of its parent. But the Button isn't getting positioned under it. Instead it's displaying in the top left corner. Am I doing something incorrectly or is this a bug with RelativeLayout?
View 1 Replies
View Related
Nov 16, 2009
I want to share the same view.mTag value of a viewgroup to all the childs under that viewgroup.
Like all childs should call the getTag() of viewgroup to get the tag .How can i do that ?
View 2 Replies
View Related
Jun 9, 2010
Why I can't implement OnKeyListener with parameter View such as on example where parameters are (View v, int keyCode, KeyEvent event) I'm forced to use parameters (DialogInterface dialog, int keyCode, KeyEvent event) but not the View as I want.
View 1 Replies
View Related
Jun 17, 2009
I want to have a ViewGroup with another View in it. The user should be able to move the other View around the ViewGroup, and fling it away. However, the inner View shouldnt only move, it should also scale and so on (so we dont restrain ourselves to just movements). I don't really know the best way to implement it.
First I though about using a ViewGroup pretty much as it is (i.e. take advantage of the already-written methods). Then I could do the flinging with an Animation. However, when I move the View around with my finger, wouldnt I have to do a requestLayout, since the View changes size when I move it? Or could I just set a transform?
The other alternative would be to override the draw-method and do most of the work myself. For instance, when the user moves his/her finger, I could get a cache of the View and just paint it on the Canvas (with some transform). However, how would I do the flinging then, without an Animation? I could use a Scroller/VelocityTracker, but What would "drive" the repaints? Which is the best way to do this? Also, I won't have just one View, but a couple of them, so I'd like the solution to be effective.
View 2 Replies
View Related
Jul 27, 2010
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>
Since the root element is a LinearLayout, which extends ViewGroup, why does main.xml get turned into a View instead of a ViewGroup? For example, in my main Activity class, I try to get the number of subviews that the LinearLayout contains like this:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ViewGroup vg = (ViewGroup) findViewById(R.layout.main);
Log.v("myTag", "num children: " + vg.getChildCount());
but it crashes when i call vg.getChildCount(). What is the right way of doing it?
View 1 Replies
View Related
Aug 23, 2010
Thread [<1> main] (Suspended (exception NullPointerException)) ArrayAdapter.createViewFromResource(int, View, ViewGroup, int) line: 355 ArrayAdapter.getView(int, View, ViewGroup) line: 323 ListView(AbsListView).obtainView(int, boolean[]) line: 1294 ListView.measureHeightOfChildren(int, int, int, int, int) line: 1198 My symptomremedyActivity.java looks like:................
View 2 Replies
View Related
Nov 19, 2010
I'm testing some functions with Android, JNI and NDK. I have the following JAVA class:
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
public class JNITest extends Activity {
private int contador;
/** Called when the activity is first created. */...........................
View 1 Replies
View Related
Jun 12, 2010
I wanna add three layout in a TabActivity, but it was force closed when I ran it.
Here is the code:
import android.app.TabActivity;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;
public class Test1 extends TabActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Resources res = getResources();
TabHost tabHost = getTabHost();
tabHost.addTab(tabHost.newTabSpec("egcquery").setIndicator("EGCQuery").setContent(R.layout.main1));
tabHost.addTab(tabHost.newTabSpec("PatientInfo").setIndicator("PatientInfo").setContent(R.layout.main2));
tabHost.addTab(tabHost.newTabSpec("Comp_Interp").setIndicator("Comp_Interp").setContent(R.layout.main3));}
View 1 Replies
View Related
Oct 12, 2010
There are a lot of Android SDK APIs where callback handlers are registered. For a concrete example, with MediaPlayer you can set an onCompletionListener callback. Will these callbacks be called from the main (UI) thread? If the answer is "it depends", then I'm looking for some general rules for what callbacks will be called from the main thread versus another thread. The SDK documentation doesn't seem to spell it out. (Maybe I missed it) It seems important to know, because if I'm guaranteed main thread callbacks, then I can skip some thread synchronization on data shared between different places in code. If I'm forced to be pessimistic out of ignorance, then I have to write extra synch block code and worry about deadlocks, data integrity, and reduced performance.
View 4 Replies
View Related
Jun 3, 2010
I am having an interesting problem and would appreciate any advice. My app uses WebView as its primary view. Using a javascript hook, it can launch the camera so the user can take a picture. The camera is launched using: Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
When the camera starts, it makes sense to use landscape mode, so the user naturally turns the phone on its side. After the user takes a picture, control returns to my launching Activity (actually, my Acitivity gets restarted because it usually gets destroyed to free up memory for the camera on my Moto Droid). When my WebView gets recreated, I restore its state from the Bundle I saved in onSaveInstanceState().
Now everything looks ok, except the phone is still in landscape mode. However, when the user turns the phone upright bringing back into portrait mode, my WebView takes up only half of the screen. Somewhere along the way, the scale of my WebView got lost. This seems like such a minor issue, but it is driving me crazy.
Does anyone have an idea why this might be happening? What is the correct way to preserve the scale of my WebView? I am hesitant to hard code any scale factors because what looks good on my device may not be the same for another.
View 8 Replies
View Related
Apr 10, 2010
In my android app, I'm setting an alarm that I want to occur repeatedly, hence using AlarmManager.setRepeating().
I don't want to keep track of whether the alarm is set myself (sounds like a bad idea that's prone to fail at some point), and there seems to be no API support for checking whether a particular alarm is already set for a given Intent.
Hence, I am pessimistically resetting the alarm each time my app activates:
alarmManager.cancel(pendingIntent);
...
alarmManager.setRepeating(..., pendingIntent);
Question: is calling setRepeating() idempotent i.e. do I need to explicitly cancel() any prior alarm or can I safely just call setRepeating() and be done with it?
View 1 Replies
View Related
Jan 9, 2010
After following some instructions on Diego Torres blog I am able to test my classes using the regular Eclipse JUnit test-runner, however I also want to be able to run my unit tests from within the emulated android environment. For now this should make no real difference since the classes I am working on do very basic numerical or networking tasks, but obviously anything which involves the UI or Android API specific functions can only ever be tested on the emulator.
I set up a new run configuration of type AndroidJUnitTest wich uses the ndroid.test.InstrumentationTestRunner, however whenever I fire up the test I get the following error in the console:
[2010-01-09 00:45:23 - Pal1]Uploading Pal1.apk onto device 'emulator-5556'....................
View 1 Replies
View Related
Oct 26, 2009
I am trying to extend a class in android.widget, specifically AbsSpinner class for some change in behavior. For that I need to access some protected members of the Classes up in the hierarchy, so I decided to put my new class in the same package android.widget It compiles fine in Eclipse but when I run it, it gives me java.lang.VerifyError. When I tried to find the cause, I came to know that this error is caused by the format of the class file different from what Android expects it to be.
View 9 Replies
View Related
Apr 19, 2009
Detail Descriptioin: 1. When I use the same code to access "http://www.google.com", it works. 2. When I use the same code to access "https://www.google.com", it doesn't work and will throw IllegalArgumentException..............
View 2 Replies
View Related
Nov 20, 2010
I'd like to ask about how to proper handle progressDialog in Thread, since gettings the error from subject.
My code:
CODE:.......
Problem occurs when a dialog progress appears and I change my phone orientation, it freezes and crashes.
View 3 Replies
View Related
Jun 16, 2009
I have a custom view that I had to write for a large scrollable image, as the images are larger than the size of the screen. Before, I had tried to do it by putting the image into a ScrollView but that of course didn't work. The view itself is within a RelativeLayout within the activity and at the bottom of the screen I have two buttons that are used for navigation and at the top a TextView with a caption for the activity (the main header is already being used here for instruction). In my below code, I've checked the Hierachy Viewer to confirm all the elements are loaded and in the Activity I can see the TextView, however it overlays the ZN5ScrollView area and below the image I just have a blank area of the size defined rather than my buttons. For the bottom navigation, the Hierachy Viewer is saying the absolute_y of the bottom navigation is 480. I'm wondering if anyone can help with my layout code here to get this working correctly? Bottom navigation is 50px high, ZN5ScrollView is 365px above the navigation, and the TextView takes up the rest of the area at the top
View 4 Replies
View Related
Oct 6, 2010
I have a layout xml file with a linear layout. One of the children is again a ViewGroup Relative layout. In my java code i want to change the width of this child Viewgroup for my requirements. I tried this
ViewGroup childViewGroup = (LinearLayout)findViewById(childViewGroup);
LayoutParams l = childViewGroup.getLayoutParams();
l.width = 360;
childViewGroup .setLayoutParams(l);
I couldn't do this because findViewById(childViewGroup) doesn't fetch ViewGroups it does only for Views. Note: I cant define a whole new layout.xml for this minor requirement since it is huge layout file and might cause performance overhead. I wanted to just change the width of the child view group in my java activity code.
View 1 Replies
View Related
May 9, 2009
I am wondering how to track down this IAE? It doesn't mention my code (com.newsrob.*) in the stack trace.
Is there anymore information that I can automatically gather and include in the bug reports to get a better understanding why this happens?
CODE:..............................
View 7 Replies
View Related
Jul 29, 2010
it's possible to hook process in Android? for example we can hook process in windows:"trap events that will occur, either in your own process or in other processes. By "hooking", you tell Windows about a function, filter function also called hook procedure, that will be called everytime an event you're interested in occurs"
View 1 Replies
View Related
Aug 11, 2010
How i can display custom error message before foreclose or Application not responding message will happen for an application.
Or
Can i display Custom message like "Please wait....." instead of Application not responding message.
View 1 Replies
View Related
Sep 2, 2009
How to use viewGroup in android
View 3 Replies
View Related