Skip to main content

Posts

Showing posts from February 27, 2012

NSRangeException when deleting cell using a different class

I looked through my code and I printed my array I was using and it appears to be fine, yet this error still persists. * Terminating app due to uncaught exception 'NSRangeException', reason: '* -[__NSArrayM removeObjectAtIndex:]: index 1 beyond bounds [0 .. 0]' My guess was that it had something to do with my indexPath but it doesn't make much different how much I change it. -(void)checkboxTapped:(id)sender { [sender setSelected:YES]; [self.textLabel setTextColor:[UIColor grayColor]]; [self.detailTextLabel setTextColor:[UIColor grayColor]]; parent = [[ViewController alloc] init]; UITableView *tableView = parent.tableView; NSMutableArray *array = [[NSMutableArray alloc] initWithArray:parent.array]; [parent release]; NSIndexPath *indexPath = [NSIndexPath indexPathForRow:[array count] inSection:1]; [array removeObjectAtIndex:[indexPath row]]; [db deleteTaskAtIndex:[indexPath row]]; [tableView deleteRowsAtIndex

display UIMenuController on tab on cell

I have uitableview I want to display UIMenuController when I tab on cell such that if the content of the cell is text the menu show edit , send by mail else listen, send by mail adn hide it it if I leaved it or tab away of it, something like right click context menue any idea how to achieve that I did something like that - (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath { return YES; } - (BOOL)tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender { return (action == @selector(copy:)); } - (void)tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender { if (action == @selector(copy:)) NSLog(@"in real life, we'd now copy somehow"); } but I need to customize the menu itself, and also implementing those thre methods doesn't show anything Best regards

GPS and draw MapRout in iphone

I have a latitude and longitude that is fixed, so I used that and got the point in mapview with pin. Now I want the current location and draw route, so I think using gps I get the latitude and longitude. Using this location(latitude & longitude) I have to draw a route with my fixed value (latitude & longitude). How is it possible..? Is this is the right way to do it? ?How to draw the route with two point..? I have used the delegate method but it doesn't call, - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { [manager stopUpdatingHeading]; NSLog(@"latitude=%f",newLocation.coordinate.latitude); NSLog(@"longitude=%f",newLocation.coordinate.longitude); }

iOS ARC - weak and strong properties

I'm trying to understand the way ARC works, and as far as I know, I should be doing something wrong here. This is the code I'm using: Interface: @interface ViewController : UIViewController{ } @property (strong, nonatomic) NSString * myString ; @property (weak, nonatomic) NSString * myPointer ; Implementation: - (void)viewDidLoad{ [super viewDidLoad]; self.myString = @"Hello world!" ; // myString is strong self.myPointer = self.myString ; // myPointer var is weak [self performSelector:@selector(makeNilMyValue) withObject:nil afterDelay:1]; [self performSelector:@selector(printValues) withObject:nil afterDelay:2]; } - (void) makeNilMyValue{ self.myString = nil ; } - (void) printValues{ NSLog(@"myString: %@", self.myString) ; NSLog(@"myPointer: %@", self.myPointer) ; } After executing this, I get: 2012-02-26 11:40:41.652 test1[933:207] myString: (null) 2012-02-26 11:40:41.653 test1[933:207] myP

NSFetchRequest for all children of a parent

How do I fetch all child entities of a parent? I have a table populated by a parent entity in Core Data. When the user touches a cell I intend to show another table with all children of that parent. How does the NSFetchRequest look like for this please? Edit: model is like this: student>>dates [one to many, one student have many days] So I want all dates for any given student (selected by touching in student table cell for that student), then populate dates table with dates for that student. Thanks!

Create Section With Complex Linq query

I'm trying to create a section with linq from xml file. my xml file build like this: <root> <Item> <name>a</name> <status>new</status> </Item> <Item> <name>b</name> <status>old</status> </Item> </root> I want to create the section by the following way if the status tag = "new it will create an entry element and if its old it will create a stringelement i thought of something like this new section() { from x in myXdoc.Descendants("Item") where x.element("Status").value == "new" || x.element("Status").value == "old" ?????? }

Three UIViewControllers on the same window

I want to develop the following application: on top I have a navigation bar, in the middle a TableViewController and on the bottom I have a custom control that is actually a slider (when I move the slider I want to present another TableViewController - but my navigation bar remains the same). And when I select a cell in the TableView I want to push a new ViewController (so I will change my navigation bar) and I will also dismiss my custom control. I have attached a picture of the prototype of my application.How would you suggest that I should implement this? My custom control is designed using IB so I think I should use the old way, using .xib files, not the Storyboard.

Memory is not released even though I explicitly release it

I am in the process of optimizing my app and making sure memory management is properly implemented. As I found the didUnload / dealloc / willAppear not reliable for implementing my memory cleanup, I decided to implement my own method so I can have full control of this memory management. Definition of my arrays in the header file @property (retain) NSMutableArray *selectedCardIDs; @property (retain) NSMutableArray *selectedRowArray; @property (retain) NSMutableArray *cardArray; @property (retain) NSMutableArray *cardIDArray; Here the release method: - (void) willReleaseObjects { [self.aCopyOfCardIDArray release]; [self.listOfItems release]; [self.aCopyListOfItems release]; [self.selectedCardIDs release]; [self.selectedRowArray release]; [self.cardArray release]; [self.cardIDArray release]; } The arrays can get very large (> 1'000 entry each), why a release of those arrays is essential after the view is unloaded. I explicitly call this function in the IBAction method, su

Can"t do mathematical operations with int from NSUserDefaults

i have integer data, stored in NSUserDefaults, there is my code: - (IBAction)addButton:(id)sender { NSInteger oldValue = [[NSUserDefaults standardUserDefaults] integerForKey:@"myValue"]; NSString *string1=[addTextField text]; int add = [string1 floatValue]; int new = globalCalories; int old=oldValue; if(recomended.text==[NSString stringWithFormat:@"%i", oldValue]){ **self.day = (int)roundf(old-add); dayLeft.text=[NSString stringWithFormat:@"%d", oldValue-add]; }** else { self.day=(int)roundf(new-add); dayLeft.text=[NSString stringWithFormat:@"%d", day]; } } I copied all of button action code, just in case, but i did mark with bold strings of code, that appear to not work. So, it suppose to do mathematical operations with stored data (oldValue), but when i launch programs, it dosnt, in fact, it does, but instead of valid value program "think" that oldValue is

iPhone Development w/ xCode 3.2.4

I just bought the book: Sams Teach Yourself iPhone Application Development in 24 Hours. In the book it uses xCode 3.2.4, so I went ahead and tried xCode 4.3 (the current version), but I didn't understand what to do... I then found this page... https://developer.apple.com/downloads/index.action I downloaded the version of xCode used in the book (just so I could see the same thing the book shows). But, I'm getting two errors each having something to do with the Interface Builder... "This version of Interface Builder does not support documents of type "Interface Builder Cocoa Touch Document (XIB 3.x)" targeting "iPhone/iPod touch"." And it comes up twice for two different documents in my xCode project. How can i get it to work? In the book the code I put in works just fine. Also my Mac Version is: 10.7.3

IOS Development downloading app before making it public

Hello i want to know if i can download my app before making it public some how after apple's approval process. I've already submitted my app (it's an update) and now i'm waiting for review. Is there anyway testing it before making it public? Before uploading it i've checked making it public whenever i want to. So it won't be public unless i say so.

Objective C create new class which is an image?

Sorry I'm new to Objective C and OOP, and I'm trying to understand how to use classes. I have searched everywhere but can't find a clear answer. So in my game I want a NEW ball to be created when i tap and drag an image of a ball. Would I create a ball class, and when I tap the ball, an instance of the ball class will be created. How do I set that class to be an image of a ball?

NavigationControllers and UITabBar

I have my app like this : a navigationBar in the app delegate with have a Controller1(UIViewController) like a rootController, in the controller1 i push controller2 ( UIViewController), the controller2 have 3 UINavigationController, and a Custom tabBar, each navigationController have a root controller, and finally i put all the navigationController in the CustomTabBar. My question is : is this clean( good) to do like this ? If no how i can organize my project ? MyAppDelegate.h @property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) UINavigationController *navigationController; @property (strong, nonatomic) CustomTabBar *tabBarController; MyAppDelegate.m { UIViewController *controller1 = [[UIViewController alloc] initWithNibName:nil bundle:nil]; self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. self.window.backgroundColor = [UIColor whiteColor]; navigation

iOS WebView > Display only main-content from a website including pictures

How do I fetch just the main-content part of a webpage and display it in an UIWEBVIEW? Link to the page When I look at the code of the webpage I see that the 'What is new?' posts appear below: <div id="content-header" class="clearfix"> <a name="main-content" id="main-content"></a> <h1 class="title">Aktuell</h1> </div> <!-- /#content-header --> Is it possible to relate to id="main-content within the UIWEBVIEW to display just this part of the website instead of the whole page? Screenshot shows visually what I like to get. P.S This is my code to display the whole webpage: - (void)viewDidLoad { [super viewDidLoad]; NSString *golfClubURL = @"http://golfplatz-altenstadt.de"; NSURL *loungeURL = [NSURL URLWithString:golfClubURL]; NSURLRequest *myrequest = [NSURLRequest requestWithURL:loun

Error in calling xml parser method

I am using retailligence barcode api and using nsxml parser method to parse the response below is the code but it didn't give call to parsing method. What's wrong there. Please help { NSString *myxmlstr = [NSString stringWithFormat:@"http://apitest.retailigence.com/v1.2/products?apikey=rMMzX5IDYVmTjQ3A7D9sZXukjKiZVmdD&barcode=%@&latitude=37.439097&longitude=-122.175806",brcode]; NSLog(@"my myxmlsstr is %@",myxmlstr); dataselected = NO; NSURL * xmlURL = [NSURL fileURLWithPath:myxmlstr]; myParser = [[NSXMLParser alloc] initWithContentsOfURL:xmlURL]; myParser.delegate = self; BOOL success = [myParser parse]; if(success){ NSLog(@"Properly done "); } else{ NSLog(@"not done"); } } Thanks in advance.

Calendar synch?

I am looking to synchronize a google calendar into my in app calendar but I don't have any idea of how to do this. The idea is that the synchronized calendar could be seen by any user that has this app. Thanks

iOS app: Uploading multiple files in the background

For iOS, I am aware that apps can upload in the background, as according to this thread: Uploading in background thread in iOS When I refer to "background", I mean the user has clicked the home button, using another app, or the phone's screen is off. Follow-up Questions: 1. Is there a timeout limit to the background uploading? This may be an issue if the file being uploaded is huge. 2. Is it possible to upload a list of files in the background, or does it only support the finishing of one upload that was in progress before the user switched to another app? 3. I suppose if the user quits the app completely, the upload will be stopped? Quitting completely as in, user double clicks home button, touches and holds down on the app until it starts shaking, then clicks the "X" to shut it down.

View floating above all ViewControllers

Is it possible on iOS that a view always floats above all other views. I ask this because what I would like to achieve is a view that floats above a ViewController, and then a Modal View Controller slides in, whilst that particular view is still floating over that Modal View Controller (hope you get what I am trying to say).

Crash when switching to ListView?

I have a normal LinearLayout for my main.xml , and my second activity is a ListView . I have a button on main.xml that should take me to the ListView . I get an Unexpected Error message and have to force close when I press the button. Main.xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:weightSum="1" android:background="@drawable/forzabg"> <ImageView android:id="@+id/mainlogo" android:layout_width="210dp" android:layout_height="119dp" android:layout_gravity="center" android:layout_weight="0.00" android:scaleType="fitXY" android:src=&q

ImageView showing up in debug mode, but not in run mode

My case is a little special.... I'm trying to get an image via tcp and make it show into my device screen. Please, don't ask me to do it with another kind of way to get the image, since this is the only way i can do it, and that's not my issue. What happens is that when i'm debuging step-by-step my program, the image shows up into my screen. But when i run it without debuging, it doesn't show up. This is my main.xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/textview" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Hello World, MyActivity" /> <ImageView android:id=&

if & else statements

I'm looking for some help with a little problem I'm having. Basically i have a "if & else" statement in my app but I want to add another "if" statement that checks for a file then for certain line of text in that file. But I am unsure of how to do this. on "if" check if file exists on "if" check if file exists but DOES NOT contain a certain line of text on "else" do something here is what i i have if(file.exists()) { do this } else { do this }

Keeping ListFragments in a FragmentPager in sync

Let's say I have a list of homogenous items which is likely to be changed in the lifetime of my Activity by user interaction or OS events. The Activity contains a FragmentPager which shows a number of ListFragment s. These fragments share the previously mentioned data but display it in different ways. E.g. they differ in sorting order or display only a subset of the data. Currently each fragment keeps a separate list containing the respective part of the data in the respective order. When the data changes, basicly every fragment has to be updated. This means resorting or adding/removing items from some of the fragments. What is the best practice to keep the data in the different fragments consistent? Currently I have some sort of an observer object, which is notified when something changes and subsequently notifies the connected fragments. But there are a couple of problems: When the app just started, some of the fragments haven't been created by the FragmentPager

Android Activity causing Service crash due to heap fragmentation

I have an Android app (activity) which also has a corresponding service. The service is started by the activity and is supposed to run continuously even when the activity is stopped. When the activity is started again it can bind to the service and query it. Sometimes the activity gets destroyed and created by the OS. This should not affect things, the activity should just be re-created and be able to bind to the service again. This basically works. However... I have found that both the Dalvik VM heap and the native heap are non-compacting and therefore constantly increase in size until the activity runs out of memory and crashes (even though the total memory usage is actually constant and not leaking). This is much exacerbated by destroying and re-creating the activity since a lot of allocations are done during the creation process. This pretty much guarentees that the activity will crash after a number of restarts. This doesn't bother me that much, but what then happens

using opengl texture coordinates

From my understanding the texture coordinates are s,t and go from 0,0 to 1,1. So if you wanted half the texture you would use .5 instead of 1. No matter what I do I get the whole texture so let me show what I have and attach the png texture. How do I map the first half of the texture to the quad? Thanks for any help !test image that has 4 sub images - http://www.sendspace.com/file/6b5y7x ///Main activity thread: public void onSurfaceCreated(GL10 gl, EGLConfig config) { myquad.loadGLTexture(gl, this.context); gl.glEnable(GL10.GL_BLEND); gl.glBlendFunc(gl.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA); gl.glEnable(GL10.GL_TEXTURE_2D); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST); gl.glDisable(GL10.GL_DEPTH_TEST); x=y=0; } public void onSurfaceChanged

Android: How do I stop Runnable?

I tried this way: private Runnable changeColor = new Runnable() { private boolean killMe=false; public void run() { //some work if(!killMe) color_changer.postDelayed(changeColor, 150); } public void kill(){ killMe=true; } }; but I can't access kill() method!

How to adapt basic android service to run an activity in the background?

I want to create an android service which is able to fetch and parse JSON data into my local database. I have already written the code for this to be done as a normal activity. But I would like to change it so that it updates the database on a regular basis. How would I go about doing this? So far I have created a basic service but I do not know how to tie in my activity into the service or how to set the service to start up when the application is opened up. Basic Data Service public class DataFetcher extends Service { private static final int POLL_PERIOD=120000; private AtomicBoolean active=new AtomicBoolean(true); @Override public void onCreate() { super.onCreate(); } @Override public IBinder onBind(Intent intent) { return(null); } @Override public void onDestroy() { super.onDestroy(); } private Runnable threadBody=new Runnable() { public void run() { while(active.get()) {

PayPal for Android adding products

I am getting started with PayPal SDK for Android https://www.x.com/developers/ebay but I can't understand, where i can specify my products to buy. Like Product1 = 1$, Product2 = 3$, Product3 = 9.99$ etc. Can anyone provide me with this information? Thanks.

Viewpager with multiple views inside like "Pulse&rdquo; app strip

I'm using ViewPager according to this wonderful tutorial: http://thepseudocoder.wordpress.com/2011/10/05/android-page-swiping-using-viewpager/ This tutorial show how to display only one "page" or view in every time/swip. How can I make something like the strip in Pulse app: That have the snapping effect like ViewPager but can have multiple views inside?

Monodroid swipe

I need to implement swipe for my application. Meanwhile i find lots of examples on how to do this in Android, it's quite the opposite with Monodroid. I'm having problems converting java code to c# and the mondroid documentation is just crap! Cant find anything about onFling or similar approaches. Anyone that can point me in the right direction, maybe a tutorial or code snippet? My plan is to use a viewflipper with the swipe detection. Thanks!

return value from Async task in android

one simple question: is it possible to return a variable in Async task? //my async task is in outer class private class myTask extends AsyncTask<Void,Void,Void>{ //initiate vars public myTask() { super(); //my params here } protected Void doInBackground(Void... params) { //do stuff return null; } @Override protected void onPostExecute(Void result) { //do stuff //here! how to return a value??? } } // i execute it from my activity // codes below are from different class than the async task myTask.execute() myvalue = myTask.getvalue() //something like this????

Broadcast receiver not getting extra

I have an app using a tab bar host api that I found and I am trying to use it to change activities when I receive a Sms message. The receiver that was build into this tab host is the following: public class ChangeTabBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { int index = intent.getExtras().getInt(CURRENT_TAB_INDEX); setCurrentTab(index); } } This is defined in the ScrollableTabActivity.java, then the ScrollableTabHost extends this and is called in the bellow method when a Sms is reveived: Intent intent2 = new Intent(context,ScrollableTabHost.class); intent2.putExtra("CURRENT_TAB_INDEX", index); intent2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent2); There is also an OnTabChanged listener build in which prints the index of the tab to the log. When i send a text from the emulator I shows that the tab was changed to index 0 twice, no matter whic

Issue with AudioRecord behaviour

I'm struggling to get things right using AudioRecord. Basically what I'm trying to do is seldomly record from the audio on my Android device. I don't have to get a continuous stream of bytes from the audio source, but I have to feed a buffer every 5 minutes or so. The problem is that the memory used by my program increases everytime I'm recording (I used the DDMS to investigate my memory issue). I reduced my code to the following lines to better understand the issue. buffersizebytes = AudioRecord.getMinBufferSize(SAMPPERSEC, channelConfiguration, audioEncoding); tabbAudioBuffer = new byte[buffersizebytes]; setContentView(R.layout.main); audioRecord = new AudioRecord( android.media.MediaRecorder.AudioSource.MIC, SAMPPERSEC, channelConfiguration, audioEncoding, buffersizebytes); int i=1000; while(i-->0) { audioRecord.startRecording(); audioRecord.stop(); } audioRecord.release();

Using the STL with Android NDK C++

I am trying to use the STL in an Android NDK C++ File. I try to use map, vector and various other stl classes and I cannot compile it because it doesn't find the files. My classes header starts with: #pragma once #include <map> #include <iostream> #include <stdexcept> #include <vector> #include <set> #include <list> #include <algorithm> and I get following error messages: 2> In file included from jni/../../Classes/Assist/Test.cpp:1: 2> jni/../../Classes/Assist/Test.h:2:15: error: map: No such file or directory 2> jni/../../Classes/Assist/Test.h:3:20: error: iostream: No such file or directory 2> jni/../../Classes/Assist/Test.h:4:21: error: stdexcept: No such file or directory 2> jni/../../Classes/Assist/Test.h:5:18: error: vector: No such file or directory 2> jni/../../Classes/Assist/Test.h:6:15: error: set: No such file or directory 2> jni/../../Classes/Assist/Test.h:7:16: error: list: No such file or dire

Android App crashes at line 54(Integer.parseInt) and not entirely sure why

I've been debugging my app with my phone and all the logcat errors I get refer to line 54 in my activity where I parse a String into an Int. The basic idea of the app is a penny converter in which the user enters the number of pennies they wants to convert and is divided from quarters down to the remainder pennies. At this point I'm not sure if I'm properly catching the event and have gone back and forth on using an anonymous inner class and just implementing in the class. Here's the code for the java app: public class PennyConverterActivity extends Activity { EditText et; TextView tv; int cents; int remaining; int quarters; int dimes; int nickels; int pennies; String result; @Override public void onCreate(Bundle b) { super.onCreate(b); setContentView(R.layout.main); et = (EditText) findViewById(R.id.penny); et.setText(result); et.setOnKeyListener(new View.OnKeyListener()

Edittext in Listview with wrong input onresume

I have a a listview with each row having a text field and edittext field. I have them all fight on screen. When I resume the activity by either getting a call, going back etc the input in the edittext fields does not match up with what was originally enter into. I was wondering how I could setup onresume or a saved instant state to prevent that and insure that the correct input is in the correct edittext field. This is the code I'm working with. public class editview extends ListActivity { private dbadapter mydbhelper; private PopupWindow pw; public static int editCount; public static ListView listView; public ItemAdapter adapter; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mydbhelper = new dbadapter(this); mydbhelper.open(); View footer = getLayoutInflater().inflate(R.layout.footer_layout, null); ListView

Hide my app contacts from user

I want to use the contacts API but for my specific application my users will most likely not want these contacts polluting their contact list. The application is targeted for delivery drivers and I want to use Contacts to keep track of past deliveries. I don't really care if the user can edit or change the contacts, but I don't want to confuse the user by having these contacts start populating in their address book. Any ideas? Otherwise I will use a SQLite Database but I hate re-inventing functionality.

PhoneGap Better Error Handling? (Android)

I'm working on a simple photo viewing app using PhoneGap on Android.. for the most part I can get it working with absolutely no problems but am finding that occasionally when loading a .gif image the page just fails and PhoneGaps just terminates the whole application with an error something along the lines of: The connection to the server was unsuccessful. (file://android_asset/www/index.html?href=424) My wonder is if I can have PhoneGap nicely handle that error by not killing the application. I'm doing what I can on the server end to make sure animated gif's don't get filtered into the application but in the event it is and the app can't handle it I can't have my application quitting on me all the time.

OpenCV with Android

I'm just after setting up OpenCV for android in Eclipse following this tutorial , I have the samples which do not use native c running fine on my phone. The problem is when I try to run the native code samples, I followed all the steps on the next page for setting up the builder in eclipse but when I try to run the samples on my phone they crash. I have used NDK before and successfully set up tesseract for android using the command line to compile the native code instead of eclipse. I think the problem is due to unsatisfiedLinkError:Couldn't load native_sample:findLibrary returned null but I am unsure. I have a screenshot here if that helps. Any suggestions would be more than welcome !!

Android Development, Back button function

just want to ask on how to call the Back button of an android phone to go back to previous screen or transaction? because as I hit on the back button of the device the application totally closes. I am building the application through eclipse with PhoneGap. Could you guys give me an example code or function on how to call the back button to go to previous page? Thank you guys for your big help.

How to create an Android Activity and Service that use separate processes

I have an Android app that consists of an activity and a service. Currently they both exist in the same process and use the same heap but I want have to separate process/heap for the service. Ie. I want the service to be completely independent of the activity so that if the activity crashes it won't affect the service. I do, however, want them to be installable as a single application. Is this possible?

Eclipse: Android Soundboard buttons are "overclickable&rdquo;

In my android soundboard, all of the buttons work perfectly and the sounds play normally, but there is a problem. The problem is that when you press a button in the app, you can press other buttons. For instance, if the button I press plays a siren like noise, I can press another button and both sounds will play at the same time. This is not what I want. Is there any code I can add to make it so that I can click only one button at a time, or some code that makes the previous sound stop and it will play the newly selected sound?

PhoneGap Fixed Orientation + ChildBrowser Non-Fixed Orientation (Android)

I'm creating a HTML/JS/CSS App using PhoneGap (1.4.1) for Android. Within the App I'm using the PhoneGap ChildBrowser plugin to display external content. I'd like to keep the orientation of the App to Landscape while allowing the ChildBrowser to rotate to the orientation of the device. I've tried applying different android:screenOrientation="" settings on each of the activities as below, but that doesn't seem to work. <activity android:name="com.phonegap.DroidGap" android:screenOrientation="sensorLandscape" > <intent-filter> .... </intent-filter> </activity> <activity android:name="com.phonegap.plugins.childBrowser.ChildBrowser" android:screenOrientation="sensor" > <intent-filter> .... </intent-filter> </activity> Is this even possible? Any help would be greatly appreciated!