Skip to main content

Posts

Showing posts from January 20, 2012

Flex iOS app version has huge font size?

I have an Android/iOS app that is almost complete, my only issue is that my iOS version has a huge font size on TextFields, whereas the Android version works perfectly? Both apps work fine when I'm testing on my computer, but when I test on the devices (iPod 4G and Galaxy S) the Galaxy S displays the font as shown on my computer but the iPod displays the text in huge letters. It's for an input textbox so it's a big deal as you can't even see what you are typing in the letter are so big!! I'm not sure what the issue is? Is there something I can add/look for to make certain the size? My is primarily coded in AS3 and I've attempted with a CSS file which looks like this: @font-face{ src: url("fonts/Incognitype.ttf"); fontFamily: IncognitypeEmbedded; fontWeight: normal; size: 10;} Any help would be awesome! Thanks!

SQLCipher Working But Incorrect Password

I've just implemented SQLCipher in my app to encrypt one fairly simple database. I followed all of the setup instructions carefully on this tutorial and the project is building and the app is running successfully. However, when I use their sample code to encrypt my database, my password is somehow incorrect and I am now unable to open my database. Here is the code: NSString *path = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent: @"dict.sqlite"]; if (sqlite3_open([path UTF8String], &database) == SQLITE_OK) { const char* key = [@"BIGSecret" UTF8String]; sqlite3_key(database, key, strlen(key)); if (sqlite3_exec(database, (const char*) "SELECT count(*) FROM sqlite_master;", NULL, NULL, NULL) == SQLITE_OK) { // password is correct, or, database has been initialized NSLog(@"Correct Password :)&qu

UIImage Resize without loss of quality

Im looking for an external library (or a method using Apple frameworks that doesn't destroy the quality) which will let me scale down images. I have tried this 'simple-image-processing-library' but it only works for black and white - I don't know how to make it work for colour images. ( http://code.google.com/p/simple-iphone-image-processing/ ) I have tried Core Graphics, UIKit, the "trevor" ( http://vocaro.com/trevor/blog/2009/10/12/resize-a-uiimage-the-right-way/ ) method - which makes EXTREMELY blurry images and really I don't know what else I can do - I can't continue programming my app without getting at least half-decent image scaling working. I think interpolation is needed to get decent results. Given the recent advances in iOS, I really hope someone can help me. This isn't a problem that only I am having, lots of other people seem to have the same problem, so if someone could solve it here, I'm sure if would appreciated by a

error with scrollToRowAtIndexPath

I am getting an error when using my application that used tableviews, the error looks like this. 2012-01-19 10:19:51.442 bcode[1176:207] *** Terminating app due to uncaught exception 'NSRangeException', reason: '-[UITableView scrollToRowAtIndexPath:atScrollPosition:animated:]: row (3) beyond bounds (3) for section (0).' *** First throw call stack: (0x16c3052 0x1920d0a 0x166ba78 0x166b9e9 0x68a136 0x3bfdf 0x6c2fbf 0x6c32d4 0x6c35d7 0x6d2666 0x87890e 0x878c17 0x878c86 0x62c499 0x62c584 0x2718e00 0x13614f0 0x15fa833 0x15f9db4 0x15f9ccb 0x1d05879 0x1d0593e 0x5fba9b 0x2838 0x2795 0x1) terminate called throwing an exception(gdb) What is happening is that when the user drills down my navigation view they can select a cell from the tableview of each view, which later will be used to build a search string. However I allow them to go back and change their selection if they made an error.. this error happens when the user changes the value of the parent view then going into

Alert password field that stores password into the keychain and checks it against original login view controller

This is what I would like to happen I have screwed this up 60 times over now. Ok, I have a login View Controller that handles the login using the username and password and a remember me switch. The login view controller verifies against an API, checks the credentials then proceeds. If the user has selected the remember me switch the password is stored. Next I have a separate deposit view controller. Once the user clicks the deposit button within this deposit controller it pops up an alert with a password field and once the password is entered it checks against the original login screen password to see if they match if they do. It pushes on another view controller and then life goes on. Otherwise if it doesnt match the stored pass and alert with and error is presented. This just doesnt seem that hard but I'm having the hardest time with it I hope I made myself clear and questions let me know. -Justin

Cylinder in OpenGL ES on iOS 5

I am pretty new in OpenGL ES and been searching the paste few days after some examples or tutorials about creating cylinders, but unfortunately without any luck! If anybody has some sample code or anything that might be of any use it would be highly appreciated. Thanks in advance.

Attempts to tap a UIButton in a UITableViewCell using UI Automation fail with "could not be tapped”

I have an iPhone app that I'm testing using UI Automation. I have a button in a UITableViewCell but when I try to tap on it using UI Automation I get the following error. Script threw an uncaught JavaScript error: target.frontMostApp().mainWindow().scrollViews()[0].elements()[element_name].tableViews()[0].elements().firstWithPredicate(name contains[c] 'Brooklyn').elements()["detailsButton"] could not be tapped I have enabled accessibility on the button in Interface Builder and assigned the accessibility label (and identifier) "detailsButton". I can retrieve the button element and have verified that it is valid. I just can't tap it for some reason. The UIButton is a round rectangular button with user interaction enabled. Thanks for any feedback.

How to share a variable between multiple Views/XIBs

I've read several similar threads, but can't seem to figure this out - sorry. I've got a project with multiple Views, including a ViewController, several "sub" views, and a NavigationController. I'd like to have an array that is accessible from any of the Views, so that I can populate a TableView or a TextField, etc. I'd like the array to be modifiable from any View that can access it. Right now I have this in the xxAppDelegate.h file: NSMutableArray *listOfHeadings; @property (strong,nonatomic) NSMutableArray *listOfHeadings; And in the xxAppDelegate.m file I populate the array: listOfHeadings = [[NSMutableArray alloc] init]; [listOfHeadings addObject:@"Heading 0"]; [listOfHeadings addObject:@"Heading 1"]; But I can't seem to access the array from other .m files. How do I do this correctly?

How safely cancel all requests in ASINetworkQueue on view deallocate

I have ASINetworkQueue with more than 1500 requests in it. Performing this number of requests takes for a while. If user leaves view controller while this queue is running the OS deallocates the view controller and I get "message sent to deallocated instance" error. I have tried to use [self.queue cancelAllOperations]; in dealloc method, but seems like it cancels only requests that are waiting in queue, not the request that is currently running and I'm getting the same error. What is the correct way to handle this situation? Is it possible to make the view controller not to be deallocated while queue is not finished even if user left it? Or is there a way to cancel all requests (including requests that are running) in queue?

Zoom very much and keep a high quality of the image without loading a large image on iPhone

Does anyone know about some framework or some tutorial to help me develop a feature into an iPhone app which will allow the user to zoom in very much on an image and display high-quality details of the image without loading the large image. Something like Google Maps. You can see an example here: http://www.zoomify.com/

Resetting UISearchbar programmatically

Is there a possibility to reset a UISearchbar with searchDisplayController programmatically which is active and already contains text? - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (tableView == self.searchDisplayController.searchResultsTableView) { searchDisplayController.searchResultsTableView.hidden = YES; searchBar.showsCancelButton = NO; [searchBar resignFirstResponder]; } } This solution is working, but there is still text in the searchBar. If i add those lines of code: searchBar.text = @""; There is always a black transparent view left. Any solutions?

i WANT to use sharekit to share images from my NSMutablearray [closed]

I am using sharekit to share images, and want to be able to share all the images upon users request not just one image I am using sharekit to share images, and want to be able to share all the images upon users request not just one image // this is the code I have for my share button UIImage *image = [UIImage imageNamed:@"Atoms"]; SHKItem *item = [SHKItem image:image title:@"Look at this picture!"]; // Make the ShareKit action sheet SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item]; // Display the action sheet [actionSheet showInView:self.view]; // this is my array I want it my sharekit will respond to all the items in the array NSMutableArray *images = [[NSMutableArray alloc] initWithObjects:@"Americans.png",@"Approach.png",@"Arianny.png",@"Atoms.png",nil];

ShareKit Facebook authorization looping

I set up ShareKit for iOS 4.3 using the instructions found here. I implemented the method to call the ActionSheet(see the code below). The Twitter method works correctly, Your asked to authorize the app to tweet on your behalf then your redirect to a view to post the tweet. - (void)myButtonHandlerAction { SHKItem *item = [SHKItem text:@"ShareKit is Awesome!"]; // Get the ShareKit action sheet SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item]; // ShareKit detects top view controller (the one intended to present ShareKit UI) automatically, // but sometimes it may not find one. To be safe, set it explicitly [SHK setRootViewController:self]; // Display the action sheet [actionSheet showFromToolbar:self.navigationController.toolbar]; } However when I click the Facebook method takes you to authourize the app but when you return to the app it never shows a post dialog. Am I missing a step?

What triggers iOS 5.0 cache purge?

As of iOS 5.0 Apple began to purge or clean the Caches directory inside individual applications when it decided the device was using too much space. Can anyone point me to the location of documentation or anecdotal information regarding at which threshold this cache cleaning occurs (for instance 90%+ disk usage) and how often it is checked?

iPhone: Notification Center Trouble

I wrote an app that allows the user to enter data in a UITextField, and one of them allows them to enter in a specific date. I'm trying to have an alert appear in the iPhones Notification Center when the date is 15 hours away, even when the app is not running at all. EDIT: New code- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UILocalNotification *localNotif = [[UILocalNotification alloc] init]; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"MMdd"]; NSDate *eventDate=[dateFormatter dateFromString:eventDateField.text]; localNotif.fireDate = [eventDate dateByAddingTimeInterval:-15*60*60]; localNotif.timeZone = [NSTimeZone defaultTimeZone]; localNotif.alertBody = @"Event Tomorrow!"; localNotif.alertAction = @"Show me"; localNotif.soundName = UILocalNotificationDefaultSoundName; localNotif.applicationIconBadgeNumber = 0; [[UIApplication

Subclassing UISearchDisplayController For Abstraction

I have multiple UIViewController that have table views. I want these VCs to just handle UI stuff as they will all search the same database. I want to subclass UISearchDisplayController so I can have this subclass handle all the data and search stuff. The VC I am working with is a UIViewController with a UITableView and a UISearchDisplayController . I have it set and can check to display the initial, or the searched data into the table view by using if/else statements like: if (tableView == self.searchDisplayController.searchResultsTableView) % else... I want this custom subclass that I'm creating to handle the code that is executed in the self.searchDisplayController.searchResultsTableView statement so I can have some abstraction and can use this custom class with other VCs. Any ideas on how to continue with this? I think I need to override some methods in the UISearchDisplayController . EDIT: Actually I may be coming into this wrong. I have it stepup the way I l

What javascript event gets fired when ios safari gets called from another app

I'm working on a mobile website / iPhone app combination. Upon entering the mobile website, I prompt the user to 'go to the app', 'download the app', or 'use mobile website'. From various entry points to the mobile website, I'm mostly worried about verification emails and text messages, so the user will check email, follow the verification link, enter Safari, get prompted to 'go to the app' and the verification link is sent to the app for it to handle. Now in the same session, if the user gets another email regarding the app, the user will check email again, follow a different verification link to Safari, and I want the 'go to the app' to work the same with the new link. Some quirks are that upon entering the mobile website, the verification link is stored and the URL is switched to site.com/home. The iphone overlay is completely separate from the rest of the site and doesn't have access to the site's storage of the verifi

Switching Between View Controllers Efficiently

In order to switch between views in my iOS app, I have been using Modal View Controllers. It works fine, but is this bad coding practice? Will it be detrimental to the memory usage of my app? In response to comments asking for more information, the views I am switching between are normal informational views. I am using three views to navigate through my app: Main View: Has buttons to navigate to specific informational views Info View: Has buttons to navigate to specific web pages for information Web View: Displays information through a UIWebview I have an improvised navigation bar at the top for navigating "back" and "home" do the main page. Overall, this is a web app with structure provided with menus in other views. I don't want to reveal what it does specifically (it's my idea), however this should be enough information to work with. I am currently switching between views like this: newViewController *newView = [[newViewController al

sharekit to share multiple images from an NSMUtablearray [closed]

Possible Duplicate: i WANT to use sharekit to share images from my NSMutablearray i am using sharekit to share images, and want to be able to share all the images upon users request not just one image // this is the code I have for my share button UIImage *image = [UIImage imageNamed:@"Atoms"]; SHKItem *item = [SHKItem image:image title:@"Look at this picture!"]; // Make the ShareKit action sheet SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item]; // Display the action sheet [actionSheet showInView:self.view]; // this is my array I want it my sharekit will respond to all the items in the array NSMutableArray *images = [[NSMutableArray alloc] initWithObjects:@"Americans.png",@"Approach.png",@"Arianny.png",@"Atoms.png",nil];

dismissModalViewControllerAnimated doesn"t return

If I push a view onto the Navcontroller it works great and I can return from it either with code or using the Nav Controller back button. Then I change it to present the view modally. The preset works but I cant get it to return and dismiss the modal view. This works... main view Tools *screen = [[Tools alloc] initWithNibName:@"Tools" bundle:[NSBundle mainBundle]]; [mainNavController pushViewController:screen animated:YES]; [screen release]; One the modal view: - (IBAction)btnCancel:(id)sender { [self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:0] animated:YES]; } But then I change it to modal like this on the modal view it does not go back to the main view. Tools *screen = [[Tools alloc] initWithNibName:@"Tools" bundle:[NSBundle mainBundle]]; [mainNavController presentModalViewController:screen animated:YES]; [screen release]; On the modal view: - (IBAction)btnCancel:(id)sender { [

removeFromSuperview and release memory management

I have a MBProgressHUD that I allocate as follows: self.progressHUD_ = [[[MBProgressHUD alloc] initWithView:self.view] autorelease]; if I call removeFromSuperview then would I have to call progressHUD release again? Also if I declare a property with something like this: NSString * title_; @property (nonatomic, retain) NSString * title_; then it is guaranteed that in my dealloc I should have a release on title right?

Designing animation for android application

What is the best way to design and embed an animation into an android app. (I'm not talking about transitions and activities in/out animations.) I can think of 2 ways of doing it: designing the animation with flash or something similar, export png-sequence with transparent bgs and creating an animation from the images in an xml file (How do I write this kind of xml?) creating a grid of images with all the frames of the animation that I've created and save it into one image. than using something like background-position in css in order to move the visible area of the image on each frame enter (By Java code, or by xml) which of this is better/most common? and how do I implement the solution (if there is a better solution - that would be great). and what programs do you usually use for this kind of task (the goal is to achieve something that works like the frog in cut the rope or the birds in angry birds for example) thanks!

How to display 2 different classes (activities) in a fragment in ANDROID?

I have an already working android app, but I need to update it for better layout on tablets. I can rewrite it no-problem, but what I want to ask is; I will have 2 fragments on screen (one for list, and one for details). When I select a customer from list, details will update itself (I have already done this without a problem). BUT, when I select an item from details fragment, it must change itself (it must be opened on details fragment, but of course it will be a different class). For example first details will be a list of details, but when I select an item from details list, it will be a different layout, maybe WebView or so.. To better represent the idea, LLLLLL DDDDDDDDDDDDDDDDDDDDDDDDDD LLLLLL DDDDDDDDDDDDDDDDDDDDDDDDDD LLLLLL DDDDDDDDDDDDDDDDDDDDDDDDDD LLLLLL DDDDDDDDDDDDDDDDDDDDDDDDDD LLLLLL DDDDDDDDDDDDDDDDDDDDDDDDDD LLLLLL DDDDDDDDDDDDDDDDDDDDDDDDDD Where "L" is list fragment, and "D" is details fragment. But I want to show 2 (or more) different cla

How to Send MMS Pro-grammatically without using Intent.ACTION_SEND

I have gone to various blog and tutorial (http://stackoverflow.com/questions/2972845/how-to-send-image-via-mms-in-android) and unable to get solution. I want the solution to send Image with SMS (i.e MMS) pro grammatically without using Intent. There is no documentation in this regard.Please suggest an alternative to do that without ACTION_SEND.

post status on facebook using scribe on android [closed]

I'm success to use scribe to tweet and retweet using scribe via my android appilcation using this code. Now, I want to post facebook status using this scribe, there is an example using scribe to access facebook from here . But I'm still confuse where I must place my string, that contain my status on program? And what is the url to post this status? If on twitter, I can put my string on this url: String tweet = URLEncoder.encode(message); String urlTweet = "http://api.twitter.com/1/statuses/update.json?status="+tweet; please somebody help me, I'm getting stuck in here. regard ahmal final OAuthService service = new ServiceBuilder() .provider(TwitterApi.class) .apiKey(consumerKey) .apiSecret(consumerSecret) .callback(callBack) .build(); final Token requestToken = service.getRequestToken(); final String authURL = service.getAuthorizationUrl(requestToken); final WebView webview = new WebView(this); webview.setWebViewClient(new Web

Android: Selector isn"t working as expected in TableRow selection

I have a TAbleLayout in my XML with 1 row i.e. te headings row. Other all rows, I add dynamically. I want to make a row selected on clicking it & on touching it. I added clickListener to each row and am able to trap click event. But when the mouse is pressed or kept pressed, I see color change, then again it comes to normal color. I want the color to stay changed until I click other row or click somewhere else to deactivate the selected row. My selector XML code : <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- Active state --> <item android:state_selected="true" android:state_focused="false" android:state_pressed="false" android:drawable="@android:color/transparent" /> <!-- Inactive state--> <item android:state_selected="false" android:state_focused="false" android:state

Two launcher activities

I have two activities marked with intent filter <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.package" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="7" /> <application android:name=".MyApp" android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <!-- work order activity --> <activity android:name=".app.WorkOrderActivity" android:label="@string/work_order" android:taskAffinity="com.package.task_for_work_order_activity" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <!-- inventory activity --> <

Barcode scanner application which sends result to a PHP application [closed]

I'm not sure that this is the right place to ask this, but I'm going to give it a try. I'm looking for an application that can read a barcode and then send the code to another application. The second application is a PHP one, an e-commerce website. The first application, the one that reads the code, can also be an iOS or Android application, I don't mind. Long story short I need an application that scans a barcode and then sends the result to a PHP application. Did any of you happen to use something like this before? Thank you.

Closing another process listener

Is there any possibility to create a listener for closing another process? Let's say I want to know when the process com.android.test.app isn't running anymore. By the way, I don't want to use threads for listening for current running apps.

Handheld iPhone Android Specific CSS not working at all

I am trying to create specific CSS for handheld devices, and I feel like I've tried every way possible with no effect. The reason I need to do this is so that handheld devices to not use fancybox but instead open the link in a new tab. To do this in the div there are 2 UL's, each with a class (screen & handheld). I want the handheld ul to be hidden on desktops and the screen ul to be hidden on handhelds which should be working using display: none on each. To get the device specific CSS to work I've tried using seperate css files in the HTML header such as: <link rel="stylesheet" type="text/css" media="screen" href="css/master.css" /> <link rel="stylesheet" type="text/css" media="handheld" href="css/handheld.css" /> or, within the master.css file: @media only screen and (max-device-width: 640px) { .screen { display: none !important; } } but this does not work

Simple BroadcastReceiver won"t work

I try to develope a simple Broadcastreceiver. Here's my code: public class MyClass extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub Bundle extras = intent.getExtras(); if (extras != null) { String state = extras.getString(TelephonyManager.EXTRA_STATE); Log.w("DEBUG", state); if (state.equals(TelephonyManager.EXTRA_STATE_RINGING)) { String phoneNumber = extras .getString(TelephonyManager.EXTRA_INCOMING_NUMBER); Toast.makeText(context, phoneNumber, Toast.LENGTH_LONG).show(); Log.w("DEBUG", phoneNumber); } } } } Manifest.xml: <uses-sdk android:minSdkVersion="10" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > &l

android fragments edittext button focus

being new to android app development, I encounter a problem regarding the interaction of android fragments, edittexts, focus and buttons. I have one fragment activity with several tabs. Most tabs have one fragment each. But in one tab, I have a ListFragment and a fragment with edittexts and buttons, which I call edit fragment. When the user selects a list item, the content of the edit fragment is shown in the current tab. When trying to edit a text there, more precisely, when hitting a different key than the backspace key, the new char is not shown, but the first button below gets the focus. Why? And how can I avoid this behavior? Earlier, I had a different activity for the edit fragment and the editing worked perfectly. But for other reasons and because it is recommended, I have only one activity now. Thank you for help! The xml for project_details1: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.andr

Header always shows in android-pulltorefresh when customize

I was trying to customize android-pulltorefresh library developed by Johan Nilson. I wanna use my own adapter rather than a String array. I was able to complete almost every thing but the pull to refresh header is always visible. (see the image) I want it to visible only when I pull the listview like it does with the demo app. I compared my code with the demo but I couldn't find any difference between them which effect layout. Thanks in advance !

Android - Ad agency that pay for impression [closed]

I was wondering what is the best Ad Agency that pays for every 1000 impressions. I have recently released my new app (Tic Tac Toe Go) and have been using AdMob, however I recently found out that they do not pay for impressions and clicks only. I would like to change this and was wondering what is the best ad agency to go for, ideally one which has a good fill rate and pays out on impressions. Thanks in advance, Raj

ISBN barcode search using eclipse/android

I know it is possible to scan a movie and see if the movie is available at the store. How would I do this using zxing? I did look over the links pertaining this and I am having a difficulty time understanding it all. I did download the .apk file and convert it to .zip, but I do not see any classes in the folders. I am really confused and I wish there was a web site that explains how to use zxing to make this possible. anyone have any web sites they know of that will get me started? thanks.

How to load a xml into a webview android

I have an xml file and I want to load the xml content to a web view where the web view will be inflated to a gallery. I have parsed and able to get the parsed values, but how do I load the xml content to a web view? I have no clue about it. Please some one help me.

Android: Prevent GPS from stopping

I have an issue with the GPS on Android. I am using the onStatusChanged(int status) with the GPSListener to read the status of the GPS. However, I notice that after some point, the GPS stops since the status returns: GpsStatus.GPS_EVENT_STOPPED How can I prevent the GPS from stopping at all? (Eventually I will stop it manually, but having it on when needed is very crucial)

XML layout overlapping AlertDialog"s Title

I am developing an Android application where the user is asked to "setup" before recording data. This is accomplished using an AlertDialog that inflates an XML layout, using such code: final AlertDialog.Builder builder = new AlertDialog.Builder(this); LayoutInflater vi = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = vi.inflate(R.layout.setup, null); builder.setView(v); On an emulator or a 2.3.3 device, it looks fine: However, the title that reads "Configure Options" is overlapped on a 2.1.1 device (which has a smaller screen). It looks more or less like this: Does anyone know what the potential problem may be? The XML layout is scroll enabled so that if it doesn't fit in the dialog, the user can scroll (which works fine in the emulator and 2.3.3, but not 2.1.1). Perhaps there is some way to make the AlertDialog fit the whole screen using Java code? Thank you for the help. EDIT: setup.xml (with names of some thi

how to stop the user from quitting the app android

My application sends an sql insert query everytime the telephone is tilted at more than 45° I need either to stop the user from quitting the application or have it still running in the background so that it still sends the queries basically I need the application to be running all the time, any ideas? thanks

Android Exception trying to open a new Activity - Surface::lock failed, already locked

When I try to open a new activity on a button press i get an Exception : 01-19 14:55:08.327: E/Surface(15454): Surface::lock failed, already locked 01-19 14:55:08.327: E/SurfaceHolder(15454): Exception locking surface 01-19 14:55:08.327: E/SurfaceHolder(15454): java.lang.IllegalArgumentException I have a game that draws on a surfaceview canvas with a thread, that runs with the main process, I'm trying to open a new dialog box for input and nothing worked so I'm simply trying to open a new Activity that will Exception, I'm using the lock and unlock and well synchronized, I tried stopping the thread and even placing a couple of views. Any help is good Thanks.

Java string splitting error

I need to split array of string and then save it into smaller string. Plz help me....what i am doing wrong..... for(int i=0; i<suburl.size(); i++){ String temp = suburl.get(i); String[] data = temp.split(" "); Log.i("DATA 0", data[0]); Log.i("DATA 1", data[1]); Log.i("DATA 2", data[2]); } here public static ArrayList<String> suburl = new ArrayList<String>(); where, suburl.get(0) = "alex 21 engineer" suburl.get(1) = "mike 22 lawyer" suburl.get(2) = "sunny 26 deisnger" suburl.get(3) = "kim 24 painter" and String[] data; But what i am getting error when splitting is ....... 01-19 20:35:09.820: E/AndroidRuntime(1672): Caused by: java.lang.ArrayIndexOutOfBoundsException 01-19 20:35:09.820: E/AndroidRuntime(1672): at flash.com.MainActivity.onCreate(MainActivity.java:119) 01-19 20:35:09.820: E/AndroidRuntime(1672): at android.app.Instrumentation.cal

onRestore not invoked for my custom BackupAgent

There are some data in my Android app that I would like to backup and restore. For that purpose I have created a custom implementation of BackupAgent. In my manifest in have included the backup agent as you can see below <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" package="com.myapp" android:versionCode="14" android:versionName="1.13" > <application android:backupAgent="com.myapp.MyBackupAgent"> <meta-data android:name="com.google.android.backup.api_key" android:value="my key" /> I have included the backup service api key, although I am testing with the emulator (Android 2.2) and it should not be necessary, because it uses the local backup transport. In order to do the test of the backup and restore I have done the following: Start the emulator with my application i

Determine width and height of a bitmap

I am using the following code snippet to create a bitmap with text. Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setStyle(Style.FILL); paint.setColor(fontColor); paint.setTextSize(fontSize); canvas.drawText("My Text", x, y, paint); Here's the catch. How do I determine the size of the Bitmap to use in the canvas beforehand? For instance if I want a bitmap with "Hello World!" on it, I want to find the width and height of it even before I draw the text on the canvas.