android

android gallery item selector

I want to use following selector drawable for android gallery image will it work ? <selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; <item state_selected="true" android:drawable="@drawable/selected_icon" > </item> <item android:drawable="@drawable/unselected_icon" > </item> </selector> ...

retrieve contact's nickname

Hello, I want to get the nickname of a contact from addressbook. I start with his phone number, query it and want the nickname (aka alias) as a result. Cursor cur = context.getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.NUMBER + " = " + incomingNumber, null, n...

To download a large file, which is a better approach to use either AsyncTask or Thread?

I've found a sample to download a large data file at the following link, http://code.google.com/p/apps-for-android/source/browse/#svn/trunk/Samples/Downloader It seems to be pretty nice (I haven't yet tested it). But I also have read some posts at the stackoverflow to do the same thing by using the AsyncTask class, not using the Thread ...

Reload activity in Android

Is it a good practice to reload an activity in Android? What would be the best way to do it? this.finish and then this.startActivity with the activity intent? ...

how to center layout to vertical in android through java code?

friends, i want to set android:layout_centerVertical="true" property of layout through java code of an image. can any one guide me how to achieve this. here is my code. RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); params.height = (int)totalHeight; img.setL...

Android Device Management

I'm looking at the possibility of using Android as a secure corporate mobile platform. One of the pre-requisites for this will be a way of managing multiple devices, security policies, software deployment, that sort of thing - essentially the things the BlackBerry Enterprise Server handles for BlackBerry or MDM (or something 3rd party l...

Use trackball for scrolling in Android ListView

hi, i have a ListView, whose content should not be selectable. i set the ListView to choiceMode="none" and set a transparent listSelector. for touch mode it acts as desired. a problem is the use of the trackball. if i try to use it for scrolling, the scroll starts after the 10th push to "down". this is caused by the invisible listSelec...

Loading image in ANDROID

How to load an image in ANDROID? ...

Android: canvas.drawBitmap with Orientation(MagnetField)Sensor

hallo, i am developing Android app with orientation sensor. now i got problem. What i want to do is, change scale and position of bitmap which read from sd card. The scale and position depend on value from orientation sensor. i use canvas.drawBitmap(), then it cause problem. the app is just shut down. other drawXXX()methods have no prob...

android : how to run a shell command from within code

I am trying to execute a command from within my code, the command is "echo 125 > /sys/devices/platform/flashlight.0/leds/flashlight/brightness" and I can run it without problems from adb shell I am using Runtime class to execute it : Runtime.getRuntime().exec("echo 125 > /sys/devices/platform/flashlight.0/leds/flashlight/brightness")...

Preloaded Android application with .so library file cannot be upgraded

I work for an operator, and we preload applications on Android phones. However, some preloaded applications, once upgraded from Market, crash. The problem is this: - the application contains a .so library file - in order to preload the complete application on a phone, the .so library file has to be placed separately into the lib di...

android multitouch image zooming?

I'm displaying an image on full screen now i want to zoom it in or out. Any one guide on how I can implement multi touch image zooming? I am using the 2.1 sdk version. ...

"javax.net.ssl.SSLException: Not trusted server certificate" exception in android

Hi, I am getting "javax.net.ssl.SSLException: Not trusted server certificate" exception when I am trying to hit https URL (.Net Webservice) from my android app. Can anyone please help me out? Below is my code: HttpParams myParams = new BasicHttpParams(); HttpProtocolParams.setVersion(myParams, HttpVersion.HTTP_1_1); Htt...

Android java.lang.VerifyError only on 1.5

I have the following code which gets call in my main activity's onCreate method public static ErrorReporter getInstance(){ if (instance == null){ instance = new ErrorReporter(); } return instance; } Only on android 1.5 calling the above method causes java.lang.VerifyError. I am not able to figure out why this is happening. ...

android thread management onPause

I have a class that extends the Thread class and has its run method implemented as so. public void run(){ while(!terminate){ if(paused){ Thread.yield(); }else{ accummulator++; } } } This thread is spawned from the onCreate method. When my UI is hidden (when the Home key is press...

which database to use

I am developing an App in which I need to authenticate password, store user personal information and setting details / preferences. All these are user-mobile specific or rather App specific and are unique for each user,the password and settings info should not be lost once phone is switched off or user exits the App, which data storage r...

Loading image in ANDROID

I want to show an image in the screen in ANDROID. please anyone help me how to do it? ...

How to avoid an empty file output when using startMethodTracing()?

I got to this site when I was looking for an answer and found a similar question, How to use startMethodTracing APIs on Android? I have the same problem than the original poster. I am trying to generate a trace file for Traceview using Debug.startMethodTracing("myapp") and I get an empty file no matter what I do while running the applic...

undefined reference and strange content of static library

Hey, I'm a real gcc newbee so excuse me if this is a silly question. I want to use opencv in android and therefore try to compile it into a static library that get's used in the android ndk build process to build a shared library that I intent to use for my android app. The build of the statc library works fine, but when building the sh...

Android Market Error Handling

I have some required try/catch statements in my application that in my testing never get called. I have sent them up with: Log.e("messaage", e.toString()); for my debugging and now that I'm ready to release I am not sure if I should take that out or not. I see in android market you can get error/crash reports and while I do not exp...