[android-developers] Re: How can you prevent somebody from calling in Android ?
Isn't it possible to catch the outgoing_call intent, prevent it from propagating, then shut down the call according to some criterias ? On Jul 31, 2:21 am, Roman roman.baumgaert...@t-mobile.com wrote: If you write your ownphoneapplication you are able to add whatever checks you want. Problem is how to prevent that children are still using the oldphoneapp? If you want to restrict the currentphoneapplication you might need to add your changes on framework level. -- Roman Baumgaertner Sr. SW Engineer-OSDC ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Jul 30, 12:17 am, e-satis info.ksam...@googlemail.com wrote: I want to write a software to allow the parents to set a limit to their childrenphonecalls. I need to lock somephonecapabilities with a password after the limits are reached. I'd like to know how I can blockphonecallsfrom being made, and receive. And if it's possible to set a white list for emergencycalls (e.g : the teen can't call friend after midnight but can call 911). --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How can you prevent somebody from calling in Android ?
I want to write a software to allow the parents to set a limit to their children phone calls. I need to lock some phone capabilities with a password after the limits are reached. I'd like to know how I can block phone calls from being made, and receive. And if it's possible to set a white list for emergency calls (e.g : the teen can't call friend after midnight but can call 911). --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Is there a way to start updating all apps in a row ?
For now, updating Android apps is a pain : you must go to the android market my download section (and not in the Manage Application system setting section, which is very counter intuitive), then scroll to each app needing an update, clic on it, run the update, and go back, then clic on the next one... I know that installing an app requires permissions, you can't do it programmatically without asking the user the permission. But is there a way to make a batch processing, like asking for the credentials once, and use it to update all the apps in a row. It would be pretty awesome to be able to code an Update manager, running in backgroup and notifying the user for updates so he can keep up regularly and quickly. Maybe it's in plan for Donut ? --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] List loading several times
I have a list containing a dozen of item, but takes a lot of time to process because each item has a lot of calculated data. On startup, I create the list once, using a custome ListAdapter while overloading the getView() method. But putting some Logs on getView, it seems that the list is created several time (the logs for the same item appear 2 or 3 times). All the code to create the list with the list adapter is in a method called in onResume, and nowhere else, so I can't figure why this is happening. Any clue ? --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Updating an app make it appear twice !
I made a lot of changes to my app : databases scheme, graphics, code, etc. The biggest is the package name that I renamed to a total different one. The applicatgio got the same name and Id in the manifeste.xml file and the apk got the same name, with the same digital signature. Nevertheless, when using ./adb install -r myapp.apk, myapp appears twice in the menu. How can I prevent this from happening, and if I can't, how can I automate he migration ? I have several clues : prompting the user for uninstalling the old app, copying the database from the old file to the new one, etc. --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Bluetooth sound output
Hello, I just noticed, using the HTC Dream that using a bluetooth headset was really easy for phone calls, but nothing seemed to be available for videos / music sound output. V1.0 limitations are not at fault since when you play a music and start a call, you can hear the music in the headset for a second. So it's technically possible, just not available in the settings. Does anybody knows how to redirect programatically the sound output to the blutooth headset ? I'd like to code a little app that let you listen to your music while looking like a total idiot with a big device hanging to your hear :-) Cheers ! --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Getting the ID of a ListView row item from a button click
Because I was planing on adding something afterward in it. On Apr 21, 11:48 pm, Marco Nelissen marc...@android.com wrote: Why are you wrapping each checkbox in its own linearlayout? On Tue, Apr 7, 2009 at 10:35 AM, e-satis info.ksam...@googlemail.comwrote: Hello, Each row of my view look like that : LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:id=@+id/row_layout LinearLayout android:id=@+id/row_checkbox_container CheckBox android:id=@+id/row_checkbox / /LinearLayout LinearLayout android:id=@+id/item_title_container TextView android:id=@+id/item_title/ /LinearLayout LinearLayout android:id=@+id/right_arrow_container ImageButton android:id=@+id/arrow / /LinearLayout /LinearLayout When I click on the ImageButton arrow, I trigger a method than need the id of the row to perform. By ID I mean the value of the field _id of the corresponding record in database. I did not find a direct way to do it, but I think I can if I get the index of the row in the ListView. Again, I don't know how to get this index from a click to a childview. Any help much appreciated ! --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Trying to understand TabHost source code
Swell, this has been reported as a bug : http://code.google.com/p/android/issues/detail?id=2516 On Apr 24, 1:28 pm, e-satis info.ksam...@googlemail.com wrote: Hello, I manage to find this post right after trying to solve something like this : http://groups.google.com/group/android-developers/browse_thread/threa... Apparently,tabsseems to still thefocusof TextView that are not part of them. Any idea of a workaround ? For the moment I just can think of overriding mTabKeyListener, but it's probably private... On Mar 6, 4:45 am, Dianne Hackborn hack...@android.com wrote: I don't believe the tab host is doing anything special for this, it is just letting the normalfocusnavigation take place. On Thu, Mar 5, 2009 at 4:00 PM, ying lcs ying...@gmail.com wrote: Thank you Dianne. I have another related question. I appreciate if you can help me with that. Let's say the a button in a tab content currently hasfocus. When I click the UP button, the tab-widget has thefocus. My question is how can the Tabhost knows that The tab-content reaches the end of its focusable control and decide to give tab-widget the focus? Thank you. On Thu, Mar 5, 2009 at 12:06 PM, Dianne Hackborn hack...@android.com wrote: The comment says is re-directs non-navigation keys to the content. It isn't intercepting the other keys, it is ignoring them (returning false). On Thu, Mar 5, 2009 at 11:42 AM, ying lcs ying...@gmail.com wrote: Hi, I am trying to understand TabHost source code. In the setup() , it has: // KeyListener to attach to alltabs. Detects non-navigation keys // and relays them to the tab content. mTabKeyListener = new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_DPAD_LEFT: case KeyEvent.KEYCODE_DPAD_RIGHT: case KeyEvent.KEYCODE_DPAD_UP: case KeyEvent.KEYCODE_DPAD_DOWN: case KeyEvent.KEYCODE_ENTER: return false; } mTabContent.requestFocus(View.FOCUS_FORWARD); return mTabContent.dispatchKeyEvent(event); } }; My question is why it intersects all LEFT/RIGHT/UP/DOWN key event? If that is the case, can i still use LEFT/RIGHT/UP/DOWN to navigate within the TabContent (let say I have a row of buttons in the TabContent. Can I use LEFT/RIGHT/UP/DOWN to move from 1 button to another in the TabContent)? Thank you. -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them. -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: EditText Tabhost problem
OK, great, I wasn't sure it would be. Sometimes, it's just you missing a point. Sadly, I strongly needed that kind of layout, but I guess I will have to way the next update. Is there a way to force compatibility check while installing an apk (like with the firefox extension) so i can make 2 versions off my app ? On Apr 27, 8:17 am, SR stan.r...@gmail.com wrote: Added to the Android bug list here: http://code.google.com/p/android/issues/detail?id=2516 On Apr 27, 12:57 am, SR stan.r...@gmail.com wrote: Confirmed as a problem in 1.5pre, in my own code on the emulator. Non-toplevelTabHost(meaning: embedded in another layout) willstealthefocusfrom an EditText elsewhere in the layout. Upon a keypress, but before the letter for the depressed key shows up in the EditText -- thefocus jumps back to the firsttab. SR --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Trying to understand TabHost source code
Hello, I manage to find this post right after trying to solve something like this : http://groups.google.com/group/android-developers/browse_thread/thread/f3fdd1eb1726/0d28c51a6b9ffdfe?lnk=gstq=tab+focus#0d28c51a6b9ffdfe Apparently, tabs seems to still the focus of TextView that are not part of them. Any idea of a workaround ? For the moment I just can think of overriding mTabKeyListener, but it's probably private... On Mar 6, 4:45 am, Dianne Hackborn hack...@android.com wrote: I don't believe the tab host is doing anything special for this, it is just letting the normal focus navigation take place. On Thu, Mar 5, 2009 at 4:00 PM, ying lcs ying...@gmail.com wrote: Thank you Dianne. I have another related question. I appreciate if you can help me with that. Let's say the a button in a tab content currently has focus. When I click the UP button, the tab-widget has the focus. My question is how can the Tabhost knows that The tab-content reaches the end of its focusable control and decide to give tab-widget the focus? Thank you. On Thu, Mar 5, 2009 at 12:06 PM, Dianne Hackborn hack...@android.com wrote: The comment says is re-directs non-navigation keys to the content. It isn't intercepting the other keys, it is ignoring them (returning false). On Thu, Mar 5, 2009 at 11:42 AM, ying lcs ying...@gmail.com wrote: Hi, I am trying to understand TabHost source code. In the setup() , it has: // KeyListener to attach to all tabs. Detects non-navigation keys // and relays them to the tab content. mTabKeyListener = new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_DPAD_LEFT: case KeyEvent.KEYCODE_DPAD_RIGHT: case KeyEvent.KEYCODE_DPAD_UP: case KeyEvent.KEYCODE_DPAD_DOWN: case KeyEvent.KEYCODE_ENTER: return false; } mTabContent.requestFocus(View.FOCUS_FORWARD); return mTabContent.dispatchKeyEvent(event); } }; My question is why it intersects all LEFT/RIGHT/UP/DOWN key event? If that is the case, can i still use LEFT/RIGHT/UP/DOWN to navigate within the TabContent (let say I have a row of buttons in the TabContent. Can I use LEFT/RIGHT/UP/DOWN to move from 1 button to another in the TabContent)? Thank you. -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them. -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: EditText Tabhost problem
Actually this is even stranger because when you use the arrow key from the keyboard and get the focus to the textview from the tab view, it does not take the focus back. Here is the XML file : ?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 LinearLayout android:padding=5px android:orientation=vertical android:id=@+id/task_edit_panel android:layout_width=fill_parent android:layout_height=fill_parent android:layout_weight=50 LinearLayout android:orientation=vertical android:layout_width=fill_parent android:layout_height=wrap_content TextView android:layout_width=wrap_content android:layout_height=wrap_content android:text=@string/title android:textStyle=bold / EditText android:id=@+id/title android:layout_width=fill_parent android:layout_height=fill_parent / /LinearLayout TabHost android:id=@+id/edit_item_tab_host android:layout_width=fill_parent android:layout_height=fill_parent TabWidget android:layout_width=fill_parent android:layout_height=wrap_content android:id=@android:id/tabs / FrameLayout android:id=@android:id/tabcontent android:layout_width=fill_parent android:layout_height=fill_parent android:paddingTop=65px !-- you need that if you don't want the tab content to overflow -- LinearLayout android:id=@+id/edit_item_date_tab android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent android:padding=5px TextView android:layout_width=wrap_content android:layout_height=wrap_content android:text=date android:textStyle=bold / /LinearLayout LinearLayout android:id=@+id/edit_item_geocontext_tab android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent android:padding=5px TextView android:layout_width=wrap_content android:layout_height=wrap_content android:text=lieu android:textStyle=bold / /LinearLayout LinearLayout android:id=@+id/edit_item_text_tab android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent android:padding=5px EditText android:id=@+id/details android:layout_width=fill_parent android:layout_height=fill_parent android:scrollbars=vertical / /LinearLayout /FrameLayout /TabHost /LinearLayout !-- Bottom pannel with add item button -- LinearLayout android:padding=5px android:orientation=horizontal android:layout_weight=1 android:id=@+id/task_edit_panel android:layout_width=fill_parent android:layout_height=wrap_content android:background=#E7E7E7 !-- Let the height set to fill_parent until we find a better way for the layout -- Button
[android-developers] Re: Null pointer exception while using setOnClickListener
I solved the problem building a custom view list adapter. I post the code here with some comments so it can help any body else : import android.content.Context; import android.database.Cursor; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.View.OnClickListener; import android.widget.CheckBox; import android.widget.ImageButton; import android.widget.SimpleCursorAdapter; import android.widget.TextView; public class ItemListAdapter extends SimpleCursorAdapter { private Context context; private int layout_id; // initialize the on click listeners. It's static so it's share with all the buttons to avoid object creation // navigation with the arrow button private static final OnClickListener arrow_button_on_click_listener = new OnClickListener() { public void onClick(View v) { // on click, get the id of the item, make it the current node // then refresh the view so we see its children InContext list = (InContext) v.getContext(); list.setCurrentNode(v.getId()); list.refreshView(); } }; // validation with the check box button // initialize the listener. It's static so it's share with all the buttons to avoid object creation private static final OnClickListener check_box_on_click_listener = new OnClickListener() { public void onClick(View v) { // on click, get the id of the item, make it the current node // then refresh the view so we see its children InContext list = (InContext) v.getContext(); // this state is the contrary of the previous one int checked = 1; if (((CheckBox) v).isChecked()) checked = 0; list.toggleItem(v.getId(), checked); } }; public ItemListAdapter(Context context, int layout_id, Cursor c,String[] from, int[] to) { super(context, layout_id, c, from, to); this.context = context; this.layout_id = layout_id; } /** * Custom view translates columns into checkbox, title and arrow * * @see android.widget.CursorAdapter#getView(int, android.view.View, android.view.ViewGroup) */ public View getView(int position, View convertView, ViewGroup parent) { // no need to manage the cursor, thanks to the simplecursoradapter, it will be on the right position Cursor cursor = getCursor(); cursor.moveToPosition(position); // get the id of the item, so we can store it in each view int index = cursor.getColumnIndex(ItemDbHelper.KEY_ID); int _id = cursor.getInt(index); /* inflate the list row view from the XML so we can instanciate it's child with findViewById if we don't do that, we'll get null from findViewById and so a null pointer exception */ // first we get the instance of the inflater that is pre configured for this phone LayoutInflater inflater = LayoutInflater.from(this.context); // then, we inflate the view with it View v = inflater.inflate(this.layout_id, parent, false); // we don't want the layout to be bound to any root for the moment, setAdapter() will do that // set the value of the item title of each row TextView item_title = (TextView) v.findViewById (R.id.item_title); index = cursor.getColumnIndex(ItemDbHelper.KEY_TITLE); item_title.setText(cursor.getString(index)); // set the status of the checkbox of each row CheckBox item_checkbox = (CheckBox) v.findViewById (R.id.row_checkbox); item_checkbox.setId(_id); index = cursor.getColumnIndex(ItemDbHelper.KEY_CHECKED); if (cursor.getInt(index) == 0) item_checkbox.setChecked(false); else item_checkbox.setChecked(true); // set the check box click listener to perform db update on clic item_checkbox.setOnClickListener(check_box_on_click_listener); // set the image of the image button according to the number of childrdb en ImageButton arrow = (ImageButton) v.findViewById (R.id.arrow_right); arrow.setId(_id); index = cursor.getColumnIndex (ItemDbHelper.KEY_CHILDREN_COUNT); if (cursor.getInt(index) == 0) arrow.setImageResource(R.drawable.arrow); else arrow.setImageResource(R.drawable.double_arrow); // set the arrow button click listener to navigate in depth in the node list arrow.setOnClickListener(arrow_button_on_click_listener); return v; } } On Apr 7, 8:56 pm, e-satis info.ksam...@googlemail.com wrote: My row
[android-developers] Re: Getting the ID of a ListView row item from a button click
Solved it the same way than in http://groups.google.com/group/android-developers/browse_thread/thread/16e2f50d9a46823a/fc448b80b6ae29cc?lnk=gstq=e-satis, adding the id to the view manually. On Apr 7, 7:35 pm, e-satis info.ksam...@googlemail.com wrote: Hello, Each row of my view look like that : LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:id=@+id/row_layout LinearLayout android:id=@+id/row_checkbox_container CheckBox android:id=@+id/row_checkbox / /LinearLayout LinearLayout android:id=@+id/item_title_container TextView android:id=@+id/item_title/ /LinearLayout LinearLayout android:id=@+id/right_arrow_container ImageButton android:id=@+id/arrow / /LinearLayout /LinearLayout When I click on the ImageButton arrow, I trigger a method than need the id of the row to perform. By ID I mean the value of the field _id of the corresponding record in database. I did not find a direct way to do it, but I think I can if I get the index of the row in the ListView. Again, I don't know how to get this index from a click to a childview. Any help much appreciated ! --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Getting the ID of a ListView row item from a button click
Hello, Each row of my view look like that : LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:id=@+id/row_layout LinearLayout android:id=@+id/row_checkbox_container CheckBox android:id=@+id/row_checkbox / /LinearLayout LinearLayout android:id=@+id/item_title_container TextView android:id=@+id/item_title/ /LinearLayout LinearLayout android:id=@+id/right_arrow_container ImageButton android:id=@+id/arrow / /LinearLayout /LinearLayout When I click on the ImageButton arrow, I trigger a method than need the id of the row to perform. By ID I mean the value of the field _id of the corresponding record in database. I did not find a direct way to do it, but I think I can if I get the index of the row in the ListView. Again, I don't know how to get this index from a click to a childview. Any help much appreciated ! --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Null pointer exception while using setOnClickListener
Hi, My java code look like this : // right_arrow button ImageButton arrow_button = (ImageButton)findViewById (R.id.arrow); arrow_button.setOnClickListener(new OnClickListener() { public void onClick(View v) { ((View)v.getParent().getParent()).setSelected(true); } }); And the corresponding XML look like : LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:id=@+id/row_layout LinearLayout android:id=@+id/row_checkbox_container CheckBox android:id=@+id/row_checkbox / /LinearLayout LinearLayout android:id=@+id/item_title_container TextView android:id=@+id/item_title/ /LinearLayout LinearLayout android:id=@+id/right_arrow_container ImageButton android:id=@+id/arrow android:layout_width=18px android:layout_height=fill_parent android:layout_gravity=bottom android:layout_weight=1 android:src=@drawable/arrow android:background=#/ /LinearLayout /LinearLayout I got a null pointer exception right after running the app in the emulator from eclipse on Ubuntu 8.10 : E/AndroidRuntime( 1426): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.getincontext/com.getincontext.InContext}: java.lang.NullPointerException E/AndroidRuntime( 1426):at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2141) E/AndroidRuntime( 1426):at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2157) E/AndroidRuntime( 1426):at android.app.ActivityThread.access$1800 (ActivityThread.java:112) E/AndroidRuntime( 1426):at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1581) E/AndroidRuntime( 1426):at android.os.Handler.dispatchMessage (Handler.java:88) E/AndroidRuntime( 1426):at android.os.Looper.loop(Looper.java:123) E/AndroidRuntime( 1426):at android.app.ActivityThread.main (ActivityThread.java:3739) E/AndroidRuntime( 1426):at java.lang.reflect.Method.invokeNative (Native Method) E/AndroidRuntime( 1426):at java.lang.reflect.Method.invoke (Method.java:515) E/AndroidRuntime( 1426):at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:739) E/AndroidRuntime( 1426):at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:497) E/AndroidRuntime( 1426):at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime( 1426): Caused by: java.lang.NullPointerException E/AndroidRuntime( 1426):at com.getincontext.InContext.onCreate (InContext.java:51) E/AndroidRuntime( 1426):at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: 1122) E/AndroidRuntime( 1426):at android.app.ActivityThread.performLaunchActiv I searched in the other posts something similar, and It seems that it must be because the ImageButton is set to null. Unfortunately I can't find anything that would lead to it in the XML or the Java code. The button is displayed properly and eclipse does not detect any error. I guess this is runtime. I tried to cast from ImageButton to button but it doesn't change anything. So I image the trouble is from findViewById(), but arrow to exists, is a regular pgn file and is displayed by the emulator if this line is commented. The weirdest is that I got a similar statement just above, and I can't see any difference. Any clue ? --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Null pointer exception while using setOnClickListener
Update : setContentView first and before all, checked :-) On 7 avr, 20:09, e-satis info.ksam...@googlemail.com wrote: Update : Reading other posts, I tried to trash the R.java file but it was not the cause. On 7 avr, 19:48, e-satis info.ksam...@googlemail.com wrote: Hi, My java code look like this : // right_arrow button ImageButton arrow_button = (ImageButton)findViewById (R.id.arrow); arrow_button.setOnClickListener(new OnClickListener() { public void onClick(View v) { ((View)v.getParent().getParent()).setSelected(true); } }); And the corresponding XML look like : LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:id=@+id/row_layout LinearLayout android:id=@+id/row_checkbox_container CheckBox android:id=@+id/row_checkbox / /LinearLayout LinearLayout android:id=@+id/item_title_container TextView android:id=@+id/item_title/ /LinearLayout LinearLayout android:id=@+id/right_arrow_container ImageButton android:id=@+id/arrow android:layout_width=18px android:layout_height=fill_parent android:layout_gravity=bottom android:layout_weight=1 android:src=@drawable/arrow android:background=#/ /LinearLayout /LinearLayout I got anullpointerexceptionright after running the app in the emulator from eclipse on Ubuntu 8.10 : E/AndroidRuntime( 1426): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.getincontext/com.getincontext.InContext}: java.lang.NullPointerException E/AndroidRuntime( 1426): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2141) E/AndroidRuntime( 1426): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2157) E/AndroidRuntime( 1426): at android.app.ActivityThread.access$1800 (ActivityThread.java:112) E/AndroidRuntime( 1426): at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1581) E/AndroidRuntime( 1426): at android.os.Handler.dispatchMessage (Handler.java:88) E/AndroidRuntime( 1426): at android.os.Looper.loop(Looper.java:123) E/AndroidRuntime( 1426): at android.app.ActivityThread.main (ActivityThread.java:3739) E/AndroidRuntime( 1426): at java.lang.reflect.Method.invokeNative (Native Method) E/AndroidRuntime( 1426): at java.lang.reflect.Method.invoke (Method.java:515) E/AndroidRuntime( 1426): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:739) E/AndroidRuntime( 1426): at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:497) E/AndroidRuntime( 1426): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime( 1426): Caused by: java.lang.NullPointerException E/AndroidRuntime( 1426): at com.getincontext.InContext.onCreate (InContext.java:51) E/AndroidRuntime( 1426): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: 1122) E/AndroidRuntime( 1426): at android.app.ActivityThread.performLaunchActiv I searched in the other posts something similar, and It seems that it must be because the ImageButton is set tonull. Unfortunately I can't find anything that would lead to it in the XML or the Java code. The button is displayed properly and eclipse does not detect any error. I guess this is runtime. I tried to cast from ImageButton to button but it doesn't change anything. So I image the trouble is from findViewById(), but arrow to exists, is a regular pgn file and is displayed by the emulator if this line is commented. The weirdest is that I got a similar statement just above, and I can't see any difference. Any clue ? --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] [SOLVED] Null pointer exception while using setOnClickListener
My row layout is in a separate XML. It appears that findViewById only can find an inflated view. To solve that, I think I will need to create a custom ListAdapter that will bind an event to each button while inflating each view. If you see any better way, let me know. Cheers On 7 avr, 20:14, e-satis info.ksam...@googlemail.com wrote: Update : setContentView first and before all, checked :-) On 7 avr, 20:09, e-satis info.ksam...@googlemail.com wrote: Update : Reading other posts, I tried to trash the R.java file but it was not the cause. On 7 avr, 19:48, e-satis info.ksam...@googlemail.com wrote: Hi, My java code look like this : // right_arrow button ImageButton arrow_button = (ImageButton)findViewById (R.id.arrow); arrow_button.setOnClickListener(new OnClickListener() { public voidonClick(View v) { ((View)v.getParent().getParent()).setSelected(true); } }); And the corresponding XML look like : LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:id=@+id/row_layout LinearLayout android:id=@+id/row_checkbox_container CheckBox android:id=@+id/row_checkbox / /LinearLayout LinearLayout android:id=@+id/item_title_container TextView android:id=@+id/item_title/ /LinearLayout LinearLayout android:id=@+id/right_arrow_container ImageButton android:id=@+id/arrow android:layout_width=18px android:layout_height=fill_parent android:layout_gravity=bottom android:layout_weight=1 android:src=@drawable/arrow android:background=#/ /LinearLayout /LinearLayout I got anullpointerexceptionright after running the app in the emulator from eclipse on Ubuntu 8.10 : E/AndroidRuntime( 1426): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.getincontext/com.getincontext.InContext}: java.lang.NullPointerException E/AndroidRuntime( 1426): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2141) E/AndroidRuntime( 1426): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2157) E/AndroidRuntime( 1426): at android.app.ActivityThread.access$1800 (ActivityThread.java:112) E/AndroidRuntime( 1426): at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1581) E/AndroidRuntime( 1426): at android.os.Handler.dispatchMessage (Handler.java:88) E/AndroidRuntime( 1426): at android.os.Looper.loop(Looper.java:123) E/AndroidRuntime( 1426): at android.app.ActivityThread.main (ActivityThread.java:3739) E/AndroidRuntime( 1426): at java.lang.reflect.Method.invokeNative (Native Method) E/AndroidRuntime( 1426): at java.lang.reflect.Method.invoke (Method.java:515) E/AndroidRuntime( 1426): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:739) E/AndroidRuntime( 1426): at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:497) E/AndroidRuntime( 1426): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime( 1426): Caused by: java.lang.NullPointerException E/AndroidRuntime( 1426): at com.getincontext.InContext.onCreate (InContext.java:51) E/AndroidRuntime( 1426): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: 1122) E/AndroidRuntime( 1426): at android.app.ActivityThread.performLaunchActiv I searched in the other posts something similar, and It seems that it must be because the ImageButton is set tonull. Unfortunately I can't find anything that would lead to it in the XML or the Java code. The button is displayed properly and eclipse does not detect any error. I guess this is runtime. I tried to cast from ImageButton to button but it doesn't change anything. So I image the trouble is from findViewById(), but arrow to exists, is a regular pgn file and is displayed by the emulator if this line is commented. The weirdest is that I got a similar statement just above, and I can't see any difference. Any clue ? --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Null pointer exception while using setOnClickListener
Update : Reading other posts, I tried to trash the R.java file but it was not the cause. On 7 avr, 19:48, e-satis info.ksam...@googlemail.com wrote: Hi, My java code look like this : // right_arrow button ImageButton arrow_button = (ImageButton)findViewById (R.id.arrow); arrow_button.setOnClickListener(new OnClickListener() { public void onClick(View v) { ((View)v.getParent().getParent()).setSelected(true); } }); And the corresponding XML look like : LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:id=@+id/row_layout LinearLayout android:id=@+id/row_checkbox_container CheckBox android:id=@+id/row_checkbox / /LinearLayout LinearLayout android:id=@+id/item_title_container TextView android:id=@+id/item_title/ /LinearLayout LinearLayout android:id=@+id/right_arrow_container ImageButton android:id=@+id/arrow android:layout_width=18px android:layout_height=fill_parent android:layout_gravity=bottom android:layout_weight=1 android:src=@drawable/arrow android:background=#/ /LinearLayout /LinearLayout I got anullpointerexceptionright after running the app in the emulator from eclipse on Ubuntu 8.10 : E/AndroidRuntime( 1426): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.getincontext/com.getincontext.InContext}: java.lang.NullPointerException E/AndroidRuntime( 1426): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2141) E/AndroidRuntime( 1426): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2157) E/AndroidRuntime( 1426): at android.app.ActivityThread.access$1800 (ActivityThread.java:112) E/AndroidRuntime( 1426): at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1581) E/AndroidRuntime( 1426): at android.os.Handler.dispatchMessage (Handler.java:88) E/AndroidRuntime( 1426): at android.os.Looper.loop(Looper.java:123) E/AndroidRuntime( 1426): at android.app.ActivityThread.main (ActivityThread.java:3739) E/AndroidRuntime( 1426): at java.lang.reflect.Method.invokeNative (Native Method) E/AndroidRuntime( 1426): at java.lang.reflect.Method.invoke (Method.java:515) E/AndroidRuntime( 1426): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:739) E/AndroidRuntime( 1426): at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:497) E/AndroidRuntime( 1426): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime( 1426): Caused by: java.lang.NullPointerException E/AndroidRuntime( 1426): at com.getincontext.InContext.onCreate (InContext.java:51) E/AndroidRuntime( 1426): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: 1122) E/AndroidRuntime( 1426): at android.app.ActivityThread.performLaunchActiv I searched in the other posts something similar, and It seems that it must be because the ImageButton is set tonull. Unfortunately I can't find anything that would lead to it in the XML or the Java code. The button is displayed properly and eclipse does not detect any error. I guess this is runtime. I tried to cast from ImageButton to button but it doesn't change anything. So I image the trouble is from findViewById(), but arrow to exists, is a regular pgn file and is displayed by the emulator if this line is commented. The weirdest is that I got a similar statement just above, and I can't see any difference. Any clue ? --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---