Re: [android-developers] Re: app for blocking apps
yes, and you can also time bomb it when the application expires. http://stackoverflow.com/questions/1223552/how-to-time-bomb-an-android-application Enjoy, On Sun, Nov 29, 2009 at 11:31 PM, Lance Nanek lna...@gmail.com wrote: I can think of some legitimate reasons. What if the user is a parent, for example, and wants to let a very little kid use the phone. They might like to be able to setup an application white list. Without a parental code entered the phone would only run a pre- approved set of apps that the parent has checked out to make sure the kid can't get in trouble with. I think the Xbox has a similar system where a parental code can limit the rating level of games and limit online content and contacts. On Nov 29, 1:05 pm, Edward Falk ed.f...@gmail.com wrote: On Nov 28, 5:16 pm, sleith raysle...@gmail.com wrote: any one know the code to block app so cannot be launched? . thx Why would you want to do this? It sounds like you want to take control away from the user. If the user doesn't want an app launched, they can, you know, just not launch it. -- 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.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Yaron Spektor -- 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: Preference screen for IME
to answer my own question from Aug 28th: if you put this code in the method.xml you should have the settings screen up and running in no time, you should of course define the Prefs Activity in the Manifest.xml input-method xmlns:android=http://schemas.android.com/apk/res/android; android:settingsActivity=Prefs android:name=@string/settings_title android:isDefault=true / On Fri, Aug 28, 2009 at 1:32 AM, Spektor Yaron spekt...@gmail.com wrote: Hi, this seems to be an easy one, but i am not finding a solution for it...actually there are 2 different questions relating to settings here: i created a PreferenceActivity for my application (it is a softkeyboard) i am trying to add those settings to the Settings-Locale Text screen next to my Keboard. do i need to define something in the manifest to make it appear there too? if so my manifest is below: activity android:name=Prefs android:label=@string/settings_title intent-filter action android:name=android.intent.action.MAIN/ /intent-filter /activity the activity works fine if i get to it through the application also, i was trying to get a ListPreference value to show it in the summary. i could not get it unless i made a change to the list (invoking ChangeListener). why can i not see it when i create the ListPrefernece (i am guessing it is something to do with the lifecycle but i don't know what) i ended up taking the existing preferences and setting them in the list. it seems weird to do that as, obviously, the list knows it's default value. it shows it to me when i click it. SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); defaultStr =prefs.getString(LIST_PREF, Not Available); listPref.setSummary(Current default value is: +defaultStr); Thanks, -- Yaron Spektor -- Yaron Spektor --~--~-~--~~~---~--~~ 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: adding and reading new attributes from/to a declare-styleable
answering my own question again here: the problem below was because the parse was no longer on the Keyboard tag but was on one of the key tags it could not look back a the values defined by the keyboard. once i got that and moved the code to a place where the keyboard is parsed it started working. On Fri, Aug 28, 2009 at 3:16 AM, Spektor Yaron spekt...@gmail.com wrote: Hi, i was wondering if anyone could give me hints on this one (i am re-posting an older version of a question i once had): i created a new attrs.xml that adds some functionality to the soft keyboard sample code. i would appreciate any insight you may have on this: i added: attr name=keysImg format=reference / to: declare-styleable name=Keyboard !-- Default width of a key, in pixels or percentage of display width -- attr name=keyWidth format=dimension|fraction / !-- The image used for keys -- attr name=keysImg format=reference / /declare-styleable and added: attr name=keysImgTemp format=reference / to: declare-styleable name=Keyboard_Key . attr name=keyIcon format=reference / attr name=keysImgTemp format=reference / .. /declare-styleable in the xml layout file the data look like this: Keyboard xmlns:android=http://schemas.android.com/apk/res/android; xmlns:jk= http://schemas.android.com/apk/res/com.example.android.softkeyboard; .. jk:keysImg=@drawable/sym_keyboard_shift and the key looks like this: Key android:codes=49 android:keyIcon=@drawable/sym_keyboard_shift jk:keysImgTemp=@drawable/keypad1low/ in my code i try to reference these values TypedArray a1 = res.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.Keyboard);//get all attrs for the keyboard as defined in attrs.xml The line below DOESN'T WORK! (has null value) - WHY BitmapDrawable orgBmpDraw= (BitmapDrawable)a1.getDrawable(R.styleable.Keyboard_keysImg); TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.Keyboard_Key); //the kine below WORKS! BitmapDrawable orgBmpDraw= (BitmapDrawable)a.getDrawable(R.styleable.Keyboard_Key_keysImgTemp); //The kine below DOESN'T WORK - has null value - I eventually solved it by changing the attribute from android: to jk: so i needed to override the existing internal attr.xml with mine BitmapDrawable orgBmpDraw= (BitmapDrawable)a.getDrawable(R.styleable.Keyboard_Key_keyIcon); what am i missing here? thanks, -- Yaron Spektor -- Yaron Spektor --~--~-~--~~~---~--~~ 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: orientation changes for layouts
Thanks for the reply,sorry for the delayed response that will only work if i want to create a view. but what if the view is the same and i want to attached a dynamically created object from the layout, for example a new keyboard inside a view. you switch the keyboard using the new layout but the view is the same. this is why i need to get the resId and parse the xml and not use inflate On Sat, Oct 17, 2009 at 2:44 AM, Mark Murphy mmur...@commonsware.comwrote: Spektor Yaron wrote: Thanks again, so i went ahead and implemented that and then found out that this: public XmlResourceParser getXml(int id) throws NotFoundException { return loadXmlResourceParser(id, xml); } does not find the resource id if the layout is in layout-land (it does find it if it is in layout though) any way to work around this? If you want to use a layout file, call setContentView() on your activity, or call getLayoutInflater().inflate(). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 1.0 In Print! -- Yaron Spektor --~--~-~--~~~---~--~~ 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] orientation changes for layouts
Hi, i have a layout folder with 2 layouts. layout1 and layout2 i have another folder layout-land that has layout1 in it. i would like to be able to get to all the layouts so i could create a set of layout like this: {layout1, layout2, layout1(from layout-land folder)} is there any way i can use the existing android mechanisim to do that? if not, what would be the impact of creating my own definition of the layout folder (for example to have under the layout folder layout1, layout2 and layout_land1 and have my code do getOrientation to diffrentiate whcih one should be presented) -- Thanks, --~--~-~--~~~---~--~~ 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: orientation changes for layouts
Thanks, by calling the layout-land layout3 i loose the android built-in method to switch to it when the orientation changes. that is why i added a proposed solution for that - call the get getResources().getConfiguration().orientation myself and figure out which layout to switch to. are you saying it wouldn't work? if so, why? and what would work? On Sat, Oct 17, 2009 at 12:04 AM, Mark Murphy mmur...@commonsware.comwrote: Spektor Yaron wrote: i have a layout folder with 2 layouts. layout1 and layout2 i have another folder layout-land that has layout1 in it. i would like to be able to get to all the layouts so i could create a set of layout like this: {layout1, layout2, layout1(from layout-land folder)} is there any way i can use the existing android mechanisim to do that? Copy layout/layout1 to layout/layout3. Then, all three are available under unique identifiers. if not, what would be the impact of creating my own definition of the layout folder (for example to have under the layout folder layout1, layout2 and layout_land1 and have my code do getOrientation to diffrentiate whcih one should be presented) It won't work. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App Developer Books: http://commonsware.com/books.html -- Yaron Spektor --~--~-~--~~~---~--~~ 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: orientation changes for layouts
Thanks got it, but the point still is that Android would not know that layout3 and layout1 are the same and so if i am in layout3 it will not switch to layout1 when an orientation change occurs, right? On Sat, Oct 17, 2009 at 12:25 AM, Mark Murphy mmur...@commonsware.comwrote: Spektor Yaron wrote: by calling the layout-land layout3 i loose the android built-in method to switch to it when the orientation changes. That is not what I wrote. Copy layout/layout1 to layout/layout3. Then, all three are available under unique identifiers. You still have a landscape layout1 that would override the default layout1 when the device is in landscape mode. that is why i added a proposed solution for that - call the get getResources().getConfiguration().orientation myself and figure out which layout to switch to. are you saying it wouldn't work? No, I am saying having your own subdirectories under layout/ will not work. I now realize that is not what you meant, and I apologize for my error. You are welcome to: 1. Add android:configChanges=keyboardHidden|orientation to the activity element of the AndroidManifest.xml file for whatever activity or activities you want. 2. Override onConfigurationChanged() in those activities -- that method will be called when the configuration does change. 3. Do whatever you want to affect the orientation change (e.g., call setContentView() on whatever layout suits your fancy). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App Developer Books: http://commonsware.com/books.html -- Yaron Spektor --~--~-~--~~~---~--~~ 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: orientation changes for layouts
Thanks again, so i went ahead and implemented that and then found out that this: public XmlResourceParser getXml(int id) throws NotFoundException { return loadXmlResourceParser(id, xml); } does not find the resource id if the layout is in layout-land (it does find it if it is in layout though) any way to work around this? On Sat, Oct 17, 2009 at 12:47 AM, Mark Murphy mmur...@commonsware.comwrote: Spektor Yaron wrote: Thanks got it, but the point still is that Android would not know that layout3 and layout1 are the same and so if i am in layout3 it will not switch to layout1 when an orientation change occurs, right? Correct. Android does not support the notion of accessing two resources with the same name from different resource sets at the same time (unless there's an API for that which I have not seen, which is certainly possible). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App Developer Books: http://commonsware.com/books.html -- Yaron Spektor --~--~-~--~~~---~--~~ 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] Preference screen for IME
Hi, this seems to be an easy one, but i am not finding a solution for it...actually there are 2 different questions relating to settings here: i created a PreferenceActivity for my application (it is a softkeyboard) i am trying to add those settings to the Settings-Locale Text screen next to my Keboard. do i need to define something in the manifest to make it appear there too? if so my manifest is below: activity android:name=Prefs android:label=@string/settings_title intent-filter action android:name=android.intent.action.MAIN/ /intent-filter /activity the activity works fine if i get to it through the application also, i was trying to get a ListPreference value to show it in the summary. i could not get it unless i made a change to the list (invoking ChangeListener). why can i not see it when i create the ListPrefernece (i am guessing it is something to do with the lifecycle but i don't know what) i ended up taking the existing preferences and setting them in the list. it seems weird to do that as, obviously, the list knows it's default value. it shows it to me when i click it. SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); defaultStr =prefs.getString(LIST_PREF, Not Available); listPref.setSummary(Current default value is: +defaultStr); Thanks, -- Yaron Spektor --~--~-~--~~~---~--~~ 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: How to Access SharedPreferences created file?
hi, i am not sure if your problem was resolved or not, but this link can give you a clue on writing and reading from the file system: http://www.anddev.org/working_with_files-t115.html On Thu, Aug 6, 2009 at 12:13 PM, Prajkti prajakta.kha...@gmail.com wrote: Hi all, I am using SharedPreferences to save my ApplicationSettings. and through DDMS-FileExplorer i can see the Settings file created as data\data\packgename\shared_prefs\AppSettings.xml Now i want to copy this file and move it into Another location say SDCard. Is there any way to achieve this?? Can i access that AppSettings.xml file through some System level Code written in C? Can anyone please please help me?? -- Yaron Spektor --~--~-~--~~~---~--~~ 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: no virtual keyboard available
was your issue solved? if not i would look in settings - locale and text and check that a keyboard is set there. also, does it only happen with your app? On Wed, Aug 19, 2009 at 3:25 AM, Dianne Hackborn hack...@android.comwrote: Long pressing on menu will always open the keyboard. Did he somehow turn off the keyboard in settings? Does it show up in other applications? You'd need to do something interesting in your app to prevent the keyboard from showing up on a device without a hard keyboard. On Tue, Aug 18, 2009 at 4:54 PM, miannelle mpel...@comcast.net wrote: I have developed an app that uses setTextFilterEnabled(true). It works perfectly on my G1. My partner has a new MyTouch phone that does not have a real keyboard. He cannot use this functionality at all. He tried holding down the menu key(and so have I) but the keyboard does not appear. Without a keyboard, this app is dead on arrival. I am trying the following code to no avail. setListAdapter(new ArrayAdapterString(this, android.R.layout.simple_list_item_1, data )); getListView().setTextFilterEnabled(true); final InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput( null, 0); -- 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, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- Yaron Spektor --~--~-~--~~~---~--~~ 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: out of memory error on eclipse
i am not sure this is what you need, but eclipse works best with between 256M to 512M try this when you run eclipse (you will need to change the relevant path of course): c:\eclipse3.3\eclipse.exe *-vm c:\sun-java2-5.0\bin\java.exe* -vmargs -Xms256M -Xmx512M if that works you can add that line in your eclipse shortcut On Fri, Aug 28, 2009 at 3:25 AM, human android vanquisher.sin...@gmail.comwrote: I was using ADT for debugging and then I get this Internal error: out of memory error Is there any way to avoid this? -- Yaron Spektor --~--~-~--~~~---~--~~ 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] adding and reading new attributes from/to a declare-styleable
Hi, i was wondering if anyone could give me hints on this one (i am re-posting an older version of a question i once had): i created a new attrs.xml that adds some functionality to the soft keyboard sample code. i would appreciate any insight you may have on this: i added: attr name=keysImg format=reference / to: declare-styleable name=Keyboard !-- Default width of a key, in pixels or percentage of display width -- attr name=keyWidth format=dimension|fraction / !-- The image used for keys -- attr name=keysImg format=reference / /declare-styleable and added: attr name=keysImgTemp format=reference / to: declare-styleable name=Keyboard_Key . attr name=keyIcon format=reference / attr name=keysImgTemp format=reference / .. /declare-styleable in the xml layout file the data look like this: Keyboard xmlns:android=http://schemas.android.com/apk/res/android; xmlns:jk= http://schemas.android.com/apk/res/com.example.android.softkeyboard; .. jk:keysImg=@drawable/sym_keyboard_shift and the key looks like this: Key android:codes=49 android:keyIcon=@drawable/sym_keyboard_shift jk:keysImgTemp=@drawable/keypad1low/ in my code i try to reference these values TypedArray a1 = res.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.Keyboard);//get all attrs for the keyboard as defined in attrs.xml The line below DOESN'T WORK! (has null value) - WHY BitmapDrawable orgBmpDraw= (BitmapDrawable)a1.getDrawable(R.styleable.Keyboard_keysImg); TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.Keyboard_Key); //the kine below WORKS! BitmapDrawable orgBmpDraw= (BitmapDrawable)a.getDrawable(R.styleable.Keyboard_Key_keysImgTemp); //The kine below DOESN'T WORK - has null value - I eventually solved it by changing the attribute from android: to jk: so i needed to override the existing internal attr.xml with mine BitmapDrawable orgBmpDraw= (BitmapDrawable)a.getDrawable(R.styleable.Keyboard_Key_keyIcon); what am i missing here? thanks, -- Yaron Spektor --~--~-~--~~~---~--~~ 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 all the resources from other apks
Thanks Dianne for all your help, i want to make sure i understand: it will be done very differently than what you are describing here (rather would probably be something like the approach I was describing before). meaning querying for the resource ids reliyng on thier sequential nature? and then getting their resource name etc. from the getResourceEntryName(int resid) for example you could just define the resource IDs that are in the skin and what they should contain and not have to worry about any analysis of the resources. not sure i understand what you mean. how do you define the resource IDs? as they are generated. are you referring to hard coding the allowed names in Resources for each skin? or maybe using the file system instead of the resources (would i be able to inflate a layout the resides on the file system and not in resources?) What i would like to accomplish is to not know anything about the xml file naming (i will need to know about layout and drawable etc.) On Mon, Aug 24, 2009 at 8:18 AM, Dianne Hackborn hack...@android.comwrote: I'm sorry, I thought you were just bringing up skins as an example. The platform currently doesn't support skinning, and when/if it ever does, it will be done very differently than what you are describing here (rather would probably be something like the approach I was describing before). If you want to implement some kind of skinning for your app, you are on your own, and can do whatever you want. And you really don't need to make this hard -- for example you could just define the resource IDs that are in the skin and what they should contain and not have to worry about any analysis of the resources. On Sun, Aug 23, 2009 at 5:15 PM, Spektor Yaron spekt...@gmail.com wrote: Thanks Dianne, i appreciate your help. firstly i am not even sure how to do the single skin version you suggested, unless i state that the resources names must not change which is something i am not eager to do. secondly, i was thinking (in terms of skins) to allow multiple skins at once. so the user selects one or more skins and can see them (lets say i have one default skin and then i click on a change skin button and change it to the next one in line). so my idea (and hopefully i will be able to post it here soon for everyone to use) was to take all the relevant apks based on the intent-filter, and show them to the user to be able to choose from, thus creating a list of skin, for this i need to load the resources for the drawable and the layout etc. (again, skins are just an example) from all the apks i got back from the search. as i said earlier, i may be missing something and there may be a much easier way to do it in android Thanks, Yaron On Mon, Aug 24, 2009 at 3:03 AM, Dianne Hackborn hack...@android.comwrote: I'm not sure what this has to do with skinning. I don't know of any applications that scan for different resources for a skin; rather, you create a skin by replacing the existing (layout, drawable, etc) resource with a different one. On Sun, Aug 23, 2009 at 2:18 PM, Spektor Yaron spekt...@gmail.comwrote: Hi, i know it is done somehow by other applications (for example adding new skins to an existing application w/o knowing the name of the layout ahead of time) what am i missing here. is this not the way to do it? should i copy all resources to the file system and read them from there? would that make sense? would i be able to inflate a view with them this way? Thanks, On Sun, Aug 23, 2009 at 6:44 PM, Dianne Hackborn hack...@android.comwrote: I don't believe there is any way to do that from an application. From a desktop, you can use the aapt dump commands to find out about the contents of the .apk. On Sun, Aug 23, 2009 at 8:15 AM, Spektor Yaron spekt...@gmail.comwrote: Hi, i was able to play around with the resource on a different apk and get them using createPackageContext as you suggested. here is an example of the code: otherAppContext = this.createPackageContext(com.android.demo.notepad2,Context.CONTEXT_INCLUDE_CODE + Context.CONTEXT_IGNORE_SECURITY); int resID = otherAppContext.getResources().getIdentifier(icon, drawable, com.android.demo.notepad2); this works well. now i am trying to get ALL the drawables (or all the layouts) in this package. i tried a multitude of ways including reflection and AssetManager but was unsuccessful. any tips here? just to be clear i can not use R.drawable.icon as this is a different context -- Yaron Spektor -- 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, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- Yaron Spektor -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private
[android-developers] getting all the resources from other apks
Hi, i was able to play around with the resource on a different apk and get them using createPackageContext as you suggested. here is an example of the code: otherAppContext = this.createPackageContext(com.android.demo.notepad2,Context.CONTEXT_INCLUDE_CODE + Context.CONTEXT_IGNORE_SECURITY); int resID = otherAppContext.getResources().getIdentifier(icon, drawable, com.android.demo.notepad2); this works well. now i am trying to get ALL the drawables (or all the layouts) in this package. i tried a multitude of ways including reflection and AssetManager but was unsuccessful. any tips here? just to be clear i can not use R.drawable.icon as this is a different context -- Yaron Spektor --~--~-~--~~~---~--~~ 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: Screen rotation
Hi Kabir, if you mean how do you catch these events and change the layout this could help: http://www.devx.com/wireless/Article/40792/1954 On Sun, Aug 23, 2009 at 1:27 AM, kabir kab...@gmail.com wrote: Hi, I have an activity which I have defined to keep in portrait position. However I would still like to change things (slightly) when the screen is rotated, what is the best way of doing this? I notice onConfigurationChanged is still called, but this still reports portrait mode. I want to keep the notification bar etc in the same position if possible. Cheers Kabir -- Yaron Spektor --~--~-~--~~~---~--~~ 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 all the resources from other apks
Hi, i know it is done somehow by other applications (for example adding new skins to an existing application w/o knowing the name of the layout ahead of time) what am i missing here. is this not the way to do it? should i copy all resources to the file system and read them from there? would that make sense? would i be able to inflate a view with them this way? Thanks, On Sun, Aug 23, 2009 at 6:44 PM, Dianne Hackborn hack...@android.comwrote: I don't believe there is any way to do that from an application. From a desktop, you can use the aapt dump commands to find out about the contents of the .apk. On Sun, Aug 23, 2009 at 8:15 AM, Spektor Yaron spekt...@gmail.com wrote: Hi, i was able to play around with the resource on a different apk and get them using createPackageContext as you suggested. here is an example of the code: otherAppContext = this.createPackageContext(com.android.demo.notepad2,Context.CONTEXT_INCLUDE_CODE + Context.CONTEXT_IGNORE_SECURITY); int resID = otherAppContext.getResources().getIdentifier(icon, drawable, com.android.demo.notepad2); this works well. now i am trying to get ALL the drawables (or all the layouts) in this package. i tried a multitude of ways including reflection and AssetManager but was unsuccessful. any tips here? just to be clear i can not use R.drawable.icon as this is a different context -- Yaron Spektor -- 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, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- Yaron Spektor --~--~-~--~~~---~--~~ 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 all the resources from other apks
Hi again, just to verify that i am explaining myself correctly. my code takes all the relevant apk's based on the intent filter and wants to take all the resources from the \layout to later be able to inflate them. i get the package name (e.g.,com.android.demo.notepad2) from the returned resolveInfo and i know the folder name (e.g., layout etc.) all i need now is a method to get all the resources in something like: com.android.demo.notepad2:layout on a diffrent apk. thanks On Mon, Aug 24, 2009 at 12:18 AM, Spektor Yaron spekt...@gmail.com wrote: Hi, i know it is done somehow by other applications (for example adding new skins to an existing application w/o knowing the name of the layout ahead of time) what am i missing here. is this not the way to do it? should i copy all resources to the file system and read them from there? would that make sense? would i be able to inflate a view with them this way? Thanks, On Sun, Aug 23, 2009 at 6:44 PM, Dianne Hackborn hack...@android.comwrote: I don't believe there is any way to do that from an application. From a desktop, you can use the aapt dump commands to find out about the contents of the .apk. On Sun, Aug 23, 2009 at 8:15 AM, Spektor Yaron spekt...@gmail.comwrote: Hi, i was able to play around with the resource on a different apk and get them using createPackageContext as you suggested. here is an example of the code: otherAppContext = this.createPackageContext(com.android.demo.notepad2,Context.CONTEXT_INCLUDE_CODE + Context.CONTEXT_IGNORE_SECURITY); int resID = otherAppContext.getResources().getIdentifier(icon, drawable, com.android.demo.notepad2); this works well. now i am trying to get ALL the drawables (or all the layouts) in this package. i tried a multitude of ways including reflection and AssetManager but was unsuccessful. any tips here? just to be clear i can not use R.drawable.icon as this is a different context -- Yaron Spektor -- 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, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- Yaron Spektor -- Yaron Spektor --~--~-~--~~~---~--~~ 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 all the resources from other apks
Thanks Dianne, i appreciate your help. firstly i am not even sure how to do the single skin version you suggested, unless i state that the resources names must not change which is something i am not eager to do. secondly, i was thinking (in terms of skins) to allow multiple skins at once. so the user selects one or more skins and can see them (lets say i have one default skin and then i click on a change skin button and change it to the next one in line). so my idea (and hopefully i will be able to post it here soon for everyone to use) was to take all the relevant apks based on the intent-filter, and show them to the user to be able to choose from, thus creating a list of skin, for this i need to load the resources for the drawable and the layout etc. (again, skins are just an example) from all the apks i got back from the search. as i said earlier, i may be missing something and there may be a much easier way to do it in android Thanks, Yaron On Mon, Aug 24, 2009 at 3:03 AM, Dianne Hackborn hack...@android.comwrote: I'm not sure what this has to do with skinning. I don't know of any applications that scan for different resources for a skin; rather, you create a skin by replacing the existing (layout, drawable, etc) resource with a different one. On Sun, Aug 23, 2009 at 2:18 PM, Spektor Yaron spekt...@gmail.com wrote: Hi, i know it is done somehow by other applications (for example adding new skins to an existing application w/o knowing the name of the layout ahead of time) what am i missing here. is this not the way to do it? should i copy all resources to the file system and read them from there? would that make sense? would i be able to inflate a view with them this way? Thanks, On Sun, Aug 23, 2009 at 6:44 PM, Dianne Hackborn hack...@android.comwrote: I don't believe there is any way to do that from an application. From a desktop, you can use the aapt dump commands to find out about the contents of the .apk. On Sun, Aug 23, 2009 at 8:15 AM, Spektor Yaron spekt...@gmail.comwrote: Hi, i was able to play around with the resource on a different apk and get them using createPackageContext as you suggested. here is an example of the code: otherAppContext = this.createPackageContext(com.android.demo.notepad2,Context.CONTEXT_INCLUDE_CODE + Context.CONTEXT_IGNORE_SECURITY); int resID = otherAppContext.getResources().getIdentifier(icon, drawable, com.android.demo.notepad2); this works well. now i am trying to get ALL the drawables (or all the layouts) in this package. i tried a multitude of ways including reflection and AssetManager but was unsuccessful. any tips here? just to be clear i can not use R.drawable.icon as this is a different context -- Yaron Spektor -- 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, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- Yaron Spektor -- 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, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- Yaron Spektor --~--~-~--~~~---~--~~ 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 all the resources from other apks
Thanks again Dianne, i don't think your solution will do as i also need to know which class i am in (i need to know that 0x7f02 is a drawable and that 0x7f03 is a layout). Is it possible to get the information i need through the AssetManager? any way to hack into the binary data structure? if not i guess it is back to the drawing-board for me. On Mon, Aug 24, 2009 at 3:09 AM, Dianne Hackborn hack...@android.comwrote: Sorry but this just isn't something we have APIs for right now. I don't recall anyone wanting to do this kind of thing before, so it hasn't been high on our priority list. Note that layout etc at the resource level are not really folder names -- they are just symbolic names for the part of the resource identifier integer that categorizes the resource. The resource system itself revolves almost entirely around integer identifiers; the symbolic names are pretty much just there for the convenience of developers. There is a big binary data structure in the .apk that is used to map from integer identifiers to the corresponding resource value (which may be stored directly inside the data structure for simple resources like integers and strings, or may be a path to another file in the .apk for things like xml data or images). You could probably hack something together by taking advantage of the current implementation detail that the resource system assigns resource identifiers in a sequential manner (sequentially incrementing the entry part and type part of the integer), to step through retrieving names until you get a resource not found exception. However, I can't make any guarantees that this will work in the future. On Sun, Aug 23, 2009 at 3:44 PM, Spektor Yaron spekt...@gmail.com wrote: Hi again, just to verify that i am explaining myself correctly. my code takes all the relevant apk's based on the intent filter and wants to take all the resources from the \layout to later be able to inflate them. i get the package name (e.g.,com.android.demo.notepad2) from the returned resolveInfo and i know the folder name (e.g., layout etc.) all i need now is a method to get all the resources in something like: com.android.demo.notepad2:layout on a diffrent apk. thanks On Mon, Aug 24, 2009 at 12:18 AM, Spektor Yaron spekt...@gmail.comwrote: Hi, i know it is done somehow by other applications (for example adding new skins to an existing application w/o knowing the name of the layout ahead of time) what am i missing here. is this not the way to do it? should i copy all resources to the file system and read them from there? would that make sense? would i be able to inflate a view with them this way? Thanks, On Sun, Aug 23, 2009 at 6:44 PM, Dianne Hackborn hack...@android.comwrote: I don't believe there is any way to do that from an application. From a desktop, you can use the aapt dump commands to find out about the contents of the .apk. On Sun, Aug 23, 2009 at 8:15 AM, Spektor Yaron spekt...@gmail.comwrote: Hi, i was able to play around with the resource on a different apk and get them using createPackageContext as you suggested. here is an example of the code: otherAppContext = this.createPackageContext(com.android.demo.notepad2,Context.CONTEXT_INCLUDE_CODE + Context.CONTEXT_IGNORE_SECURITY); int resID = otherAppContext.getResources().getIdentifier(icon, drawable, com.android.demo.notepad2); this works well. now i am trying to get ALL the drawables (or all the layouts) in this package. i tried a multitude of ways including reflection and AssetManager but was unsuccessful. any tips here? just to be clear i can not use R.drawable.icon as this is a different context -- Yaron Spektor -- 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, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- Yaron Spektor -- Yaron Spektor -- 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, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- Yaron Spektor --~--~-~--~~~---~--~~ 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] adding/changing resources on runtime
Hi, i was wondering if there is any way to load resource (such as skins etc.) that include drawables and layout information during runtime. what i mean is that the user can download a file (probably a signed apk - would it work any other way?) and would be able to install it adding to an already existing application thus adding more resources to it. Thanks, -- Yaron Spektor --~--~-~--~~~---~--~~ 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: adding/changing resources on runtime
Thanks for the answer, i was wondering if you had any links on how this could be done. that is, how do i access the resources of another apk? also i found some articles talking about opening the apk, changing data and then closing it again (i am guessing this can only be done if you resign the apk) here are a few of those links: [android-developers] Re: Share component as APK fi: msg#02111 AndroidDevelopershttp://osdir.com/ml/AndroidDevelopers/2009-02/msg02111.html Bypassing Android's Resourceshttp://journal.dedasys.com/2008/03/09/bypassing-androids-resources Thanks, On Wed, Aug 19, 2009 at 4:23 PM, Mark Murphy mmur...@commonsware.comwrote: Spektor Yaron wrote: Hi, i was wondering if there is any way to load resource (such as skins etc.) that include drawables and layout information during runtime. what i mean is that the user can download a file (probably a signed apk - would it work any other way?) and would be able to install it adding to an already existing application thus adding more resources to it. It is possible for one application to read another application's resources, though I do recall the specific technique. It is certainly possible to download graphic files or whatever and display them, but they will not be resources. It is not possible to modify the resources in an existing APK on the device. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Need Android talent? Ask on HADO! http://wiki.andmob.org/hado -- Yaron Spektor --~--~-~--~~~---~--~~ 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: adding/changing resources on runtime
Mark, i actually found your post about this: http://osdir.com/ml/AndroidDevelopers/2009-06/msg01323.html i am guessing this is what you meant, right? On Thu, Aug 20, 2009 at 3:52 AM, Spektor Yaron spekt...@gmail.com wrote: Thanks for the answer, i was wondering if you had any links on how this could be done. that is, how do i access the resources of another apk? also i found some articles talking about opening the apk, changing data and then closing it again (i am guessing this can only be done if you resign the apk) here are a few of those links: [android-developers] Re: Share component as APK fi: msg#02111 AndroidDevelopershttp://osdir.com/ml/AndroidDevelopers/2009-02/msg02111.html Bypassing Android's Resourceshttp://journal.dedasys.com/2008/03/09/bypassing-androids-resources Thanks, On Wed, Aug 19, 2009 at 4:23 PM, Mark Murphy mmur...@commonsware.comwrote: Spektor Yaron wrote: Hi, i was wondering if there is any way to load resource (such as skins etc.) that include drawables and layout information during runtime. what i mean is that the user can download a file (probably a signed apk - would it work any other way?) and would be able to install it adding to an already existing application thus adding more resources to it. It is possible for one application to read another application's resources, though I do recall the specific technique. It is certainly possible to download graphic files or whatever and display them, but they will not be resources. It is not possible to modify the resources in an existing APK on the device. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Need Android talent? Ask on HADO! http://wiki.andmob.org/hado -- Yaron Spektor -- Yaron Spektor --~--~-~--~~~---~--~~ 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: create service only
well, in some cases i guess you can. look at the manifest of the Softkeyboard sample in android 1.5: manifest xmlns:android=http://schemas.android.com/apk/res/android; package=com.example.android.softkeyboard application android:label=@string/ime_name android:debuggable=true service android:name=SoftKeyboard android:permission=android.permission.BIND_INPUT_METHOD intent-filter action android:name=android.view.InputMethod / /intent-filter meta-data android:name=android.view.im android:resource=@xml/method / /service /application /manifest in this case the SoftKeyboard extends InputMethodService hope this helps, On Mon, Aug 17, 2009 at 12:15 PM, James 030440...@163.com wrote: Sorry,You can't. On Aug 17, 3:40 pm, Honest honestsucc...@gmail.com wrote: Hello, I read all the materials but in all that we are creating service from the class which extends activity. Can i make project in which only service is exists and the entry point of the application is even Service. On Aug 13, 8:47 pm, Roman ( T-Mobile USA) roman.baumgaert...@t- mobile.com wrote: The answer to both of your questions is yes. Find information on this topic at http://www.androidcompetencycenter.com/2009/01/basics-of-android-part. .. -- 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 Aug 13, 6:16 am, Honest honestsucc...@gmail.com wrote: Hello, I want to hide my application from user so i just want to create service. Can some one tell me how can i create service only with out activity. Can some one tell me can i create only the service in whole project instead of activity. Is it feasible ?- Hide quoted text - - Show quoted text - -- Yaron Spektor --~--~-~--~~~---~--~~ 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] uploading an apk from my computer
Hi, i have a softkeyboard code that i am trying to install on my device. i was able to debug and run on my device it using eclipse, it works well as long as the USB cable is connected (of course,once i disconnect it it stops working) i tried adb install as well, that works for a few sample applications i used but not for the softkeyboard (maybe because it is an input method service?). when i try to change the input method it shows me my application name in the list but does not render it on the screen. anyone? -- Yaron Spektor --~--~-~--~~~---~--~~ 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 to get to internal.R
hi, i have read several posts about getting to internal.R but i want to make sure i got it. i understand that the SDK does not support it anymore (not even what is in public.xml?) and of course, that i shouldn't use reflection (i got that Dianne, thank you :-) how can i without taking all the relevant themes and putting them in my res folder get to this resource for example: com.android.internal.R.attr.keyboardViewStyle must i recreate the wheel? -- Yaron Spektor --~--~-~--~~~---~--~~ 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: can not debug application
Thanks Fadden, i realized my mistake yesterday and fixed it. now my problem is different (see separate post). i can't make it run on a device w/o debug (that is i put it on a web server downloaded it and it does not run) On Tue, Aug 18, 2009 at 12:03 AM, fadden fad...@android.com wrote: On Aug 15, 3:44 pm, Spektor Yaron spekt...@gmail.com wrote: I/dalvikvm( 770): Debugger thread not active, ignoring DDM send (t=0x41504e4d l=38) Add the android:debuggable=true attribute to your manifest. http://developer.android.com/guide/developing/device.html -- Yaron Spektor --~--~-~--~~~---~--~~ 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: can not debug application
OK i found the problem. i was using android.os.Debug.waitForDebugger(); in my code. the emulator knew how to deal with it and the device got stuck on it. hope this will help anyone who gets stuck on this issue On Tue, Aug 18, 2009 at 1:25 AM, Spektor Yaron spekt...@gmail.com wrote: Thanks Fadden, i realized my mistake yesterday and fixed it. now my problem is different (see separate post). i can't make it run on a device w/o debug (that is i put it on a web server downloaded it and it does not run) On Tue, Aug 18, 2009 at 12:03 AM, fadden fad...@android.com wrote: On Aug 15, 3:44 pm, Spektor Yaron spekt...@gmail.com wrote: I/dalvikvm( 770): Debugger thread not active, ignoring DDM send (t=0x41504e4d l=38) Add the android:debuggable=true attribute to your manifest. http://developer.android.com/guide/developing/device.html -- Yaron Spektor -- Yaron Spektor --~--~-~--~~~---~--~~ 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: uploading an apk from my computer
Thanks, i used the web server method and it worked great! BTW my real problem was different. i was using android.os.Debug.waitForDebugger(); in my code. the emulator knew how to deal with it and the device got stuck on it. hope this will help anyone who gets stuck on this issue (now after i fixed it,it will probably work with adb as well ) Thanks for your help On Mon, Aug 17, 2009 at 5:12 PM, Nivek kevin.gau...@gmail.com wrote: Officially, unless you have a Google Dev Phone, you have to package it as a signed .apk. Then you can deploy it on your phone as you prefer : - push it on the sdcard with USB cable and use a File Manager app to find and install it - email it to you gmail account and install APKatch to install it (without APKatch, the standard application installer fails to retrieve .apk files attached to e-mails) - upload it on a web server and open the android browser to get it from the web. On your phone you also have to authorize beforehand the installation of applications from unknown sources in the android preferences / applications menu. On 17 août, 12:45, Spektor Yaron spekt...@gmail.com wrote: Hi, i have a softkeyboard code that i am trying to install on my device. i was able to debug and run on my device it using eclipse, it works well as long as the USB cable is connected (of course,once i disconnect it it stops working) i tried adb install as well, that works for a few sample applications i used but not for the softkeyboard (maybe because it is an input method service?). when i try to change the input method it shows me my application name in the list but does not render it on the screen. anyone? -- Yaron Spektor -- Yaron Spektor --~--~-~--~~~---~--~~ 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] can not debug application
Hi, i was wondering if anyone could help me with this one. i created an input method application and tested it on the emulator (using Eclipse). it was working fine. i signed it (with my own private key and later with the debug.keystore) and installed it with adb. i see it in the list of application but when i get to an input field the screen doesn't come up (it does come up for any other input method but mine). any thoughts? i looked at the logcat but it doesn't tell me anything. here is some of it: I/ActivityManager( 52): Start proc com.sample.keyboard for service com.sample.keyboard/.SoftKeyboard: pid=770 uid=10030 gids={} I/dalvikvm( 770): Debugger thread not active, ignoring DDM send (t=0x41504e4d l=38) D/dalvikvm( 34): GC freed 222 objects / 8416 bytes in 184ms I/dalvikvm( 770): Debugger thread not active, ignoring DDM send (t=0x41504e4d l=40) D/dalvikvm( 34): GC freed 2 objects / 56 bytes in 189ms I/System.out( 770): Sending WAIT chunk I/dalvikvm( 770): Debugger thread not active, ignoring DDM send (t=0x57414954 l =1) D/dalvikvm( 34): GC freed 2 objects / 56 bytes in 123ms W/ActivityManager( 52): Timeout executing service: ServiceRecord{4343e590 com.sample.keyboard/.SoftKeyboard} I/Process ( 52): Sending signal. PID: 770 SIG: 9 I/ActivityManager( 52): Process com.sample.keyboard (pid 770) has died. W/ActivityManager( 52): Scheduling restart of crashed service com.sample.keyboard/.SoftKeyboard in 4ms -- Yaron Spektor --~--~-~--~~~---~--~~ 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] using attrs.xml
Hi, i was wondering if anyone could give me hints on this one: i created a new attrs.xml that adds some functionality to the soft keyboard sample code. i added: attr name=keysImg format=reference / to: declare-styleable name=Keyboard !-- Default width of a key, in pixels or percentage of display width -- attr name=keyWidth format=dimension|fraction / !-- Default height of a key, in pixels or percentage of display width -- attr name=keyHeight format=dimension|fraction / !-- Default horizontal gap between keys -- attr name=horizontalGap format=dimension|fraction / !-- Default vertical gap between rows of keys -- attr name=verticalGap format=dimension|fraction / !-- The global image used to crop keys from -- attr name=keysImg format=reference / /declare-styleable and added: attr name=keysImgTemp format=reference / to: declare-styleable name=Keyboard_Key . attr name=keyIcon format=reference / attr name=keysImgTemp format=reference / .. /declare-styleable in the xml file the data look like this: Keyboard xmlns:android=http://schemas.android.com/apk/res/android; xmlns:jk= http://schemas.android.com/apk/res/com.example.android.softkeyboard; .. jk:keysImg=@drawable/sym_keyboard_shift and the key looks like this: Key android:codes=49 android:keyIcon=@drawable/sym_keyboard_shift jk:keysImgTemp=@drawable/keypad1low/ in my code i try to reference these values TypedArray a1 = res.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.Keyboard);//get all attrs for the keyboard as defined in attrs.xml THIS DOESN'T WORK! (has null value) BitmapDrawable orgBmpDraw= (BitmapDrawable)a1.getDrawable(R.styleable.Keyboard_Key_keysImg); TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.Keyboard_Key); //THIS WORKS! BitmapDrawable orgBmpDraw= (BitmapDrawable)a.getDrawable(R.styleable.Keyboard_Key_keysImgTemp); //THIS DOESN'T WORK - has null value BitmapDrawable orgBmpDraw= (BitmapDrawable)a.getDrawable(R.styleable.Keyboard_Key_keyIcon); what am i missing here? thanks, --~--~-~--~~~---~--~~ 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] cropping and changing images on a soft keyboard
Hi, I am trying to crop an image on a key for a soft keyboard. i want to do the following: 1.create a key with an icon (from a Bitmap) 2.take that Bitmap and crop it 3.set the new Bitmap back on the key as an icon Optional: 4.do some or most of this from the XML using the parser (i could not get a hook to the res/drawable/image name looking at the Xml Parser) here is what i do: protected Key createKeyFromXml(Resources res, Row parent, int x, int y, XmlResourceParser parser) { Key key = new MyKey(res, parent, x, y, parser);//create a normal key Bitmap orgBmp = BitmapFactory.decodeResource(res, R.drawable.sym_keyboard_delete);//i took a new hard-coded image here, but prefer this to be coming from the xml instead, in the MyKey constructor) Bitmap cropedBitmap = Bitmap.createBitmap(orgBmp, 0, 0, 20, 10); //crop the image Canvas canvas = new Canvas(cropedBitmap);//put it in a canvas, since draw() only accepts canvas if(key.icon!=null){ //if icon exists, draw it back on the key key.icon.draw(canvas); } return key; } Any ideas why this does not work? any simpler solutions for this? Thanks, -- -- Yaron Spektor --~--~-~--~~~---~--~~ 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] cropping and changing images on a soft keyboard
Hi, I am trying to crop an image on a key for a soft keyboard. i want to do the following: 1.create a key with an icon (from a Bitmap) 2.take that Bitmap and crop it 3.set the new Bitmap back on the key as an icon Optional: 4.do some or most of this from the XML using the parser (i could not get a hook to the res/drawable/image name looking at the Xml Parser) here is what i do: protected Key createKeyFromXml(Resources res, Row parent, int x, int y, XmlResourceParser parser) { Key key = new MyKey(res, parent, x, y, parser);//create a normal key Bitmap orgBmp = BitmapFactory.decodeResource(res, R.drawable.sym_keyboard_delete);//i took a new hard-coded image here, but prefer this to be coming from the xml instead, in the MyKey constructor) Bitmap cropedBitmap = Bitmap.createBitmap(orgBmp, 0, 0, 20, 10); //crop the image Canvas canvas = new Canvas(cropedBitmap);//put it in a canvas, since draw() only accepts canvas if(key.icon!=null){ //if icon exists, draw it back on the key key.icon.draw(canvas); } return key; } Any ideas why this does not work? any simpler solutions for this? Thanks, -- --~--~-~--~~~---~--~~ 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: cropping and changing images on a soft keyboard
Hi, I found an answer to my previous question (the code for it is attached below). i think the solution is not too elegant so if you have any input on how i can make it less hard coded i would love to hear it for example i would like to set the name of the original image with xml and also the coordinated that i would like to crop from it. and then be able to extract this information from the parser. what would be the best method of doing that? if anyone is interested here is the code i used to get there: Bitmap orgBmp = BitmapFactory.decodeResource(res, R.drawable.sym_keyboard_delete); Bitmap cropedBitmap = Bitmap.createBitmap(orgBmp, 0, 0, 20, 10); BitmapDrawable bitMapDraw = new BitmapDrawable(cropedBitmap); key.icon= bitMapDraw; On Wed, Jul 29, 2009 at 11:50 PM, Spektor Yaron spekt...@gmail.com wrote: Hi, I am trying to crop an image on a key for a soft keyboard. i want to do the following: 1.create a key with an icon (from a Bitmap) 2.take that Bitmap and crop it 3.set the new Bitmap back on the key as an icon Optional: 4.do some or most of this from the XML using the parser (i could not get a hook to the res/drawable/image name looking at the Xml Parser) here is what i do: protected Key createKeyFromXml(Resources res, Row parent, int x, int y, XmlResourceParser parser) { Key key = new MyKey(res, parent, x, y, parser);//create a normal key Bitmap orgBmp = BitmapFactory.decodeResource(res, R.drawable.sym_keyboard_delete);//i took a new hard-coded image here, but prefer this to be coming from the xml instead, in the MyKey constructor) Bitmap cropedBitmap = Bitmap.createBitmap(orgBmp, 0, 0, 20, 10); //crop the image Canvas canvas = new Canvas(cropedBitmap);//put it in a canvas, since draw() only accepts canvas if(key.icon!=null){ //if icon exists, draw it back on the key key.icon.draw(canvas); } return key; } Any ideas why this does not work? any simpler solutions for this? Thanks, -- -- Yaron Spektor --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---