Stay up to date
We'll highlight new content in your collectives with a blue activity indicator on navigation items and posts.
Manage preferences
Questions
Browse questions with relevant Mobile Development tags
2,085,516 questions
4374
votes
132
answers
1.9m
views
How can I close/hide the Android soft keyboard programmatically?
I have an EditText and a Button in my layout.
After writing in the edit field and clicking on the Button, I want to hide the virtual keyboard when touching outside the keyboard. Can someone provide a ...
3566
votes
78
answers
1.2m
views
Why is the Android emulator so slow? How can we speed up the Android emulator?
I have got a 2.67 GHz Celeron processor, and 1.21 GB of RAM on a x86 Windows XP Professional machine.
My understanding is that the Android Emulator should start fairly quickly on such a machine, but ...
6423
votes
35
answers
1.5m
views
What is the difference between px, dip, dp, and sp?
What is the difference between the units of measure
px, dip, dp, and sp?
3181
votes
54
answers
836k
views
How to stop EditText from gaining focus when an activity starts in Android?
I have an Activity in Android, with two elements:
EditText
ListView
When my Activity starts, the EditText immediately has the input focus (flashing cursor). I don't want any control to have input ...
2746
votes
66
answers
1.5m
views
How can I fix 'android.os.NetworkOnMainThreadException'?
I got an error while running my Android project for RssReader.
Code:
URL url = new URL(urlToRssFeed);
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser = factory....
2336
votes
75
answers
1.6m
views
How do I center text horizontally and vertically in a TextView?
How do I center the text horizontally and vertically in a TextView, so that it appears exactly in the middle of the TextView in Android?
3115
votes
54
answers
1.3m
views
Is there a unique Android device ID?
Do Android devices have a unique ID, and if so, what is a simple way to access it using Java?
1799
votes
99
answers
658k
views
How can I make a UITextField move up when the keyboard is present - on starting to edit?
With the iOS SDK:
I have a UIView with UITextFields that bring up a keyboard. I need it to be able to:
Allow scrolling of the contents of the UIScrollView to see the other text fields once the ...
2350
votes
51
answers
773k
views
Vertically align text to top within a UILabel
I have a UILabel with space for two lines of text. Sometimes, when the text is too short, this text is displayed in the vertical center of the label.
How do I vertically align the text to always be ...
1132
votes
108
answers
906k
views
R cannot be resolved - Android error
I just downloaded and installed the new Android SDK. I wanted to create a simple application to test drive it.
The wizard created this code:
package eu.mauriziopz.gps;
import android.app.Activity;
...
1334
votes
82
answers
1.0m
views
Xcode - How to fix 'NSUnknownKeyException', Reason: "… this class is not key value coding-compliant for the key X" error?
I'm trying to link a UILabel with an IBOutlet created in my class.
My application is crashing with the following error"
***
Terminating app due to uncaught exception
'NSUnknownKeyException', ...
2877
votes
35
answers
915k
views
How can I save an activity state using the save instance state?
I've been working on the Android SDK platform, and it is a little unclear how to save an application's state. So given this minor re-tooling of the 'Hello, Android' example:
package com.android.hello;
...
1975
votes
44
answers
1.2m
views
How to get screen dimensions as pixels in Android
I created some custom elements, and I want to programmatically place them to the upper right corner (n pixels from the top edge and m pixels from the right edge). Therefore I need to get the screen ...
2093
votes
41
answers
580k
views
How to lazy load images in ListView in Android
I am using a ListView to display some images and captions associated with those images. I am getting the images from the Internet. Is there a way to lazy load images so while the text displays, the UI ...
1259
votes
69
answers
1.2m
views
You need to use a Theme.AppCompat theme (or descendant) with this activity
Android Studio 0.4.5
Android documentation for creating custom dialog boxes: http://developer.android.com/guide/topics/ui/dialogs.html
If you want a custom dialog, you can instead display an ...
1541
votes
53
answers
1.3m
views
How do I pass data between Activities in Android application?
I have a scenario where, after logging in through a login page, there will be a sign-out button on each activity.
On clicking sign-out, I will be passing the session id of the signed in user to sign-...
799
votes
105
answers
1.2m
views
"cannot resolve symbol R" in Android Studio
In every instance in all of my classes where I reference R.id.something, the R is in red and it says "cannot resolve symbol R". Also every time there is R.layout.something it is underlined in red and ...
1759
votes
40
answers
1.6m
views
Android 8: Cleartext HTTP traffic not permitted
I had reports from users with Android 8 that my app (that uses back-end feed) does not show content. After investigation I found following Exception happening on Android 8:
08-29 12:03:11.246 11285-...
1611
votes
39
answers
952k
views
How can you get the build/version number of your Android application?
I need to figure out how to get or make a build number for my Android application. I need the build number to display in the UI.
Do I have to do something with AndroidManifest.xml?
1640
votes
45
answers
1.3m
views
How can I open a URL in Android's web browser from my application?
How to open a URL from code in the built-in web browser rather than within my application?
I tried this:
try {
Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(download_link));
...
1244
votes
55
answers
648k
views
How do I "select Android SDK" in Android Studio?
After a successful import of an Eclipse-Android-Project into "Android Studio 1.4", I get the error
"Please select Android SDK"
when I click on the button to run the application in ...
2272
votes
32
answers
828k
views
What is 'Context' on Android?
In Android programming, what exactly is a Context class and what is it used for?
I read about it on the developer site, but I am unable to understand it clearly.
1097
votes
61
answers
677k
views
How to change Status Bar text color in iOS
My application has a dark background, but in iOS 7 the status bar became transparent. So I can't see anything there, only the green battery indicator in the corner. How can I change the status bar ...
1504
votes
44
answers
528k
views
Passing data between view controllers
I'm new to iOS and Objective-C and the whole MVC paradigm and I'm stuck with the following:
I have a view that acts as a data entry form and I want to give the user the option to select multiple ...
1308
votes
50
answers
709k
views
Activity has leaked window that was originally added
What is this error, and why does it happen?
05-17 18:24:57.069: ERROR/WindowManager(18850): Activity com.mypkg.myP has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@44c46ff0 ...
951
votes
69
answers
893k
views
Xcode building for iOS Simulator, but linking in an object file built for iOS, for architecture 'arm64'
I am trying to get a large (and working on Xcode 11!) project building in Xcode 12 (beta 5) to prepare for iOS 14. The codebase was previously in Objective-C, but now it contains both Objective-C and ...
1393
votes
44
answers
653k
views
Strange OutOfMemory issue while loading an image to a Bitmap object
I have a ListView with a couple of image buttons on each row. When the user clicks the list row, it launches a new activity. I have had to build my own tabs because of an issue with the camera layout. ...
1303
votes
44
answers
1.8m
views
How to get current time and date in Android
How can I get the current time and date in an Android app?
925
votes
71
answers
491k
views
"Conversion to Dalvik format failed with error 1" on external JAR
In my Android application in Eclipse, I get the following error.
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lorg/xmlpull/v1/XmlPullParser;
....
Conversion to ...
4050
votes
12
answers
375k
views
Proper use cases for Android UserManager.isUserAGoat()?
I was looking at the new APIs introduced in Android 4.2.
While looking at the UserManager class I came across the following method:
public boolean isUserAGoat()
Used to determine whether the ...
1279
votes
42
answers
546k
views
How can I disable the UITableView selection?
When you tap a row in a UITableView, the row is highlighted and selected. Is it possible to disable this so tapping a row does nothing?
738
votes
78
answers
333k
views
Why is there extra padding at the top of my UITableView with style UITableViewStyleGrouped in iOS7
Starting in iOS7, there is additional space at the top of my UITableView's which have a style UITableViewStyleGrouped.
Here is an example:
The tableview starts at the first arrow, there are 35 pixels ...
1953
votes
28
answers
540k
views
What's the difference between the atomic and nonatomic attributes?
What do atomic and nonatomic mean in property declarations?
@property(nonatomic, retain) UITextField *userName;
@property(atomic, retain) UITextField *userName;
@property(retain) UITextField *...
1611
votes
30
answers
984k
views
Transport security has blocked a cleartext HTTP
What setting do I need to put in my info.plist to enable HTTP mode as per the following error message?
Transport security has blocked a cleartext HTTP (http://) resource
load since it is insecure. ...
1322
votes
42
answers
742k
views
Run/install/debug Android applications over Wi-Fi?
I thought there was a way to test your applications in development over Wi-Fi. Is this possible?
I'd love to be able to untether my phone and develop wirelessly.
1414
votes
39
answers
519k
views
How can I check for an active Internet connection on iOS or macOS?
I would like to check to see if I have an Internet connection on iOS using the Cocoa Touch libraries or on macOS using the Cocoa libraries.
I came up with a way to do this using an NSURL. The way I ...
1128
votes
46
answers
849k
views
How to add dividers and spaces between items in RecyclerView
This is an example of how it could have been done previously in the ListView class, using the divider and dividerHeight parameters:
<ListView
android:id="@+id/activity_home_list_view"
...
577
votes
98
answers
536k
views
Error type 3 Error: Activity class {} does not exist
I have an IntelliJ Android project, that I successfully imported to Android Studio 0.4.0. It works perfectly if I don't change anything in manifest. However, when I want to change the launcher ...
1244
votes
45
answers
451k
views
Android SDK installation doesn't find JDK
I'm trying to install the Android SDK on my Windows 7 x64 System.
jdk-6u23-windows-x64.exe is installed, but the Android SDK setup refuses to proceed because it doesn't find the JDK installation.
...
1618
votes
29
answers
713k
views
Using Auto Layout in UITableView for dynamic cell layouts & variable row heights
How do you use Auto Layout within UITableViewCells in a table view to let each cell's content and subviews determine the row height (itself/automatically), while maintaining smooth scrolling ...
1164
votes
40
answers
704k
views
How to make links in a TextView clickable
I have the following TextView defined:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="@string/txtCredits"
...
1251
votes
40
answers
300k
views
Is quitting an application frowned upon?
Moving on in my attempt to learn Android, I just read the following:
Question: Does the user have a choice to kill the application
unless we put a menu option in to kill it? If no such option ...
1214
votes
38
answers
1.8m
views
How do I display an alert dialog on Android?
I want to display a dialog/popup window with a message to the user that shows "Are you sure you want to delete this entry?" with one button that says 'Delete'. When Delete is touched, it should delete ...
570
votes
91
answers
833k
views
Getting error "No such module" using Xcode, but the framework is there
I'm currently coding in Swift, and I've got an error:
No such module Social
But I don't understand, because the module is in my project, declared in "Linked frameworks and Libraries" and in "...
1271
votes
43
answers
1.1m
views
How can I develop for iPhone using a Windows development machine?
Is there any way to tinker with the iPhone SDK on a Windows machine? Are there plans for an iPhone SDK version for Windows?
The only other way I can think of doing this is to run a Mac VM image on a ...
2083
votes
23
answers
779k
views
Is there a way to run Python on Android?
We are working on an S60 version and this platform has a nice Python API..
However, there is nothing official about Python on Android, but since Jython exists, is there a way to let the snake and the ...
1463
votes
34
answers
410k
views
Activity restart on rotation Android
In my Android application, when I rotate the device (slide out the keyboard) then my Activity is restarted (onCreate is called). Now, this is probably how it's supposed to be, but I do a lot of ...
728
votes
64
answers
522k
views
How to check internet access on Android? InetAddress never times out
I got a AsyncTask that is supposed to check the network access to a host name. But the doInBackground() is never timed out. Anyone have a clue?
public class HostAvailabilityTask extends AsyncTask<...
1195
votes
37
answers
795k
views
findViewById in Fragment
I am trying to create an ImageView in a Fragment which will refer to the ImageView element which I have created in the XML for the Fragment. However, the findViewById method only works if I extend an ...
754
votes
63
answers
393k
views
Placeholder in UITextView
My application uses an UITextView. Now I want the UITextView to have a placeholder similar to the one you can set for an UITextField.
How to do this?
Members can contribute articles
Simply submit a proposal, get it approved, and publish it.
See how the process works
Simply submit a proposal, get it approved, and publish it.
See how the process works