android

Android. How to connect to development machine from device?

Hi, could you please advice how to connect to development machine from device? I can easily do this from Emulator, but from device I have connection timeout exception. Here is my code: String hostname = "10.0.2.2"; int port = 4444; Socket socket = null; try{ socket = new Socket(InetAddress.getByName(hostname), port); } catch(U...

How can I get a directory listing of resources from my Android app?

My Android application has some files in the assets directory that I want to open on startup by listing the files in the directory and opening each. I am trying to use the AssetManager to do this but it does not seem to do as I would expect. My sample code is below. Is this the correct way or is there a better way to do this? And I am...

Is it necessary that we should have ADSL connection to access internet(network) through Android Emulator?

What are the settings required to access network for those who dont have ADSL connection? Thanks. ...

Android: How to automatically display vertical scrollbar?

Hi, I created a user form which fits the window in vertical orientation. When the user slides the keyboard the form doesn't fit the screen (horizontal orientation). I tried to add the scrollbar but it is not visible. I would appreciate if anyone could show how to modify the following layout file in order to display scrollbar when the o...

A new button to Android screen

How can I display a button on screen? I have defined it as final Button nappi = (Button) findViewById(R.id.soita); and <Button android:layout_width="100px" android:layout_height="wrap_content" android:text="@+string/Soita" android:id="@+id/soita" /> ...

Specifying relative positions in Layout?

Hi All, I need to implement a screen containing a list of blocks one below the other. Each block will contain mutiple superimpose elements (Images, text) for which the relative position needs to be specified with respect to the top left corner of the block. For creating the list of blocks i have used listview. For each block i tried ...

can we put layout in center of the screen in Android

Hi All, I want to put layout in center of the screen. Please help me here. ...

Android layout centering in RelativeLayout for custom ListView

I'm really pulling my hair out over this one. Some background. I have a list of items that all have checkboxes next to them. When you deselect a checkbox, a button appears that allows you to delete the item from the list. This seems backwards at first but we only want "selected" items to be eligible for further processing, etc. This is m...

How to put TextView in same position in landscape and portrait mode in Android

Hi All, I am facing a problem when i put a textview on screen in landscape mode it position is fine but when i switch to portrait mode it position is remain fix it not change according to screen resolution. please help me here ...

Converting from a text field to an numeric in Android

If I have an EditText component on my screen that I have specified inputType="decimal" for (i.e. a numeric/decimal field), what is the best way to convert it to an decimal value in the application code? Google recommends avoiding floats, and avoiding creating objects unnecessarily (and I assume any auto-unboxing code is bad too), so I...

Android: Use a SWITCH statement with setOnClickListener/onClick for more than 1 button ?

Let's say I have a few buttons in a LinearLayout, 2 of them are: mycards_button = ((Button)this.findViewById(R.id.Button_MyCards)); exit_button = ((Button)this.findViewById(R.id.Button_Exit)); I register setOnClickListener() on both of them: mycards_button.setOnClickListener(this); exit_button.setOnClickListener(this); How do I make ...

Android OpenGL ES missing some components?

I'm trying to run the "HelloTriangle" example, from The OpenGL ES 2.0 Programming Guide, in the Android emulator. I import egl.EGLConfig and opengles.GL10 from javax.microedition.khronos, but the ESContext type and definitions such as GL_COMPILE_STATUS and GL_FRAGMENT_SHADER can't be resolved. I reworked the triangle example somewhat...

Common performance pitfalls on Android?

What are the most easy mistakes to make that can be performance sinks on Android? The documentation mentions "some floating point operations" can be "on the order of milliseconds" - has someone tested this? For the sake of discussion, let's assume its running on a G1/similar device. ...

Android: Binding data from a database to a CheckBox in a ListView?

I'm trying to bind data from my SQLiteDatabase to a ListView. I'm currently using a SimpleCursorAdapter to fill in my ListView. Unfortunately this doesn't seem to work with setting a CheckBox's checked attribute. This is how I do it now; instead of changing the CheckBox's checked status the adapter is filling in the value to the text ar...

Which mobile platform would be more rewarding to learn as a developer (iPhone vs Palm Pre vs. Android)?

I am interested in getting my feet wet in PDA/mobile development. The only two drivers for me are the drive to learn cool (or at least, new) stuff, and may be to code some app that I felt I really needed but lacked. As such, I would like to know what the comparative benefits/downsides would be for me as a developer in choosing one of t...

How to load data in expandable List Adapter

How to load data in expandable List Adapter through Scroll . Means I want to add data as per Scrolling in Run time. Thanks in advance Raj Android Developer. ...

create a transparent image programmatically in android

hello.. i am getting an image from web server (which has transparent background).now i need to save this image on my sdcard and show it to user.but when i save the image to sdcard.. it saves with a black background..i need this image with background.. i hv tried following methods to save the image --- Method 1: Bitmap bitmap = Bitmap...

Android: How to make the keypad always visible?

In android, how do we make the device keypad always visible in the application? The top portion displays the content the application wants to render and bottom portion displays the keypad always. ...

Manually added location updates stop working in Eclipse

Hi folks, I'm working on a 1.5 Android application. Developing in Eclipse 3.4.2 on Windows XP. I have a MapView, have requested updates, etc. The problem is that after the first manually injected GPS coordinate, the app stops recognizing that a GPS coord has been sent. LocationManager lm = (LocationManager) getSystemService(Contex...

Where does Android emulator store SQLite database?

Hi folks, I'm working on an Android application that stores data in a SQLite database. My question is, where does this database file get stored on the filesystem when you're using an emulator? I have seen that it's stored in /data/data/package_name/databases but I need to know where on my local machine's hard drive that actually ma...