android

Apply the Android "Dialog" theme and sizing it properly.

I have an activity that I would like to occur in a dialog. Is there anyway to do this from code, instead of in the manifest? I tried to do this, but it seemed to have no effect. @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTheme(R.style.Theme_Dialog); } Also, the activity...

APIDemos 8 Debug, setting a debug breakpoint at the first line never runs through code in the class

I set a toggle breakpoint at line 36 of the main class, of APIDemos 8, the debug begins at the OnCreate but never processes another line in the class. Why is that? Here's the code starting a line 36. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); ...

App freezes while muting the phone

Hello, I am trying to toggle the microphone of Android mobile. App. freezes if I run the mute and unmute in a loop, With a delay of say 500ms. Is there a specific reason mobile behaves this way? (Motorola Droid is not even able to mute the phone) however all other mobiles are able to do it. This runs in a loop for 20 times audioService...

Are Android thread id's global per process?

When you do a Thread.currentThread().getId(), is the resulting thread id scoped per process or scoped to the current Activity/Service? ...

Android - Activity Constructor vs onCreate

I understand that Android Activities have specific lifecycles and that onCreate should be overridden and used for initialization, but what exactly happens in the constructor? Are there any cases when you could/should override the Activity constructor as well, or should you never touch it? I'm assuming that the constructor should never b...

Is root activity the current first activity in the stack or the activity specified as launch activity in manifest?

Is root activity the current first activity in the stack or the activity specified as launch activity in manifest? Support application P starts activity A at launch. Then A starts B and finish itself, and then B starts C. Now the stack contains B and C, with B the first in the stack. Can I say B is the root activity, or A is still the ...

Unit Testing a Helper Class in Android

I'm trying to develop and android application and have developed a helper class to download some data. I want to unit test this class but, when I try and run it in the android junit runner, it fails when trying to find tests. If I try and run the test using normal junit then I'm getting a JVM error. My test class is a normal Junit 4 Cl...

Android: Extending a custom abstract Activity

Hello, I created an abstract Activity which extends the android.app.Activity. Then I created an activity extending my abstract one. [1] Everything is fine with ant, but eclipse showed an error in the manifest saying that my activiy did not exists, so I regenerate the class files and the error in the manifest is gone. But now eclipse s...

APIDemos 8 PersistenceState, where is the persistent text "saved?"

In the class PersistentState.java the prefs variable gets the saved/typed text from prior sessions here, on line 106 into restoredText. Where does the getString method get the saved/typed text? protected void onResume() { super.onResume(); ... SharedPreferences prefs = getPreferences(0); String restoredText = prefs.getStr...

Better way to create XMLs at Runtime

I am working on an Android application that is required to connect to a REST WebService. There are a number of requests that the application needs to make and the request format is XML. What I have done presently is create a Request template per XML request using StringBuilder class and substitute a placeholder String for different value...

Convert HttpURLConnection to HttpClient using multipart to send JSON + data files

I do not have as good of an understanding of HTTP as I would like to. Any insight will be greatly appreciated! I needed to upload a JSON that contained information about an object. This object could have image, audio, and video files associated with it. These data files had to be uploaded, after the JSON, as part of a multipart reque...

Can I make the user agree to a legal disclaimer before installing an Android App ?

I'm about ready to market my first Android App (from a US Google Checkout/Merchant account with US bank account etc.), and I would like to have the user at least agree to some kind of simple liability disclaimer before he/she can install the app. To your knowledge, is it possible, and if so, what would be the best way to do this? Your ...

Speed Up download time

Hi I have 40 MB file in server and i am downloading my file using HttpURLConnection c = (HttpURLConnection) u.openConnection(); c.setRequestMethod("GET"); c.setDoOutput(true); c.connect(); FileOutputStream f = new FileOutputStream(new File("trips.xml")); InputStream in = c.getInputStream(); byte[] buffer = new byte[1024]; in...

How's the android directory structure?

How the directories are disposed? Where do I copy my musics and pictures in my virtual device to test my apps? update: trying with mTools.... update: mtools fails... cant download it to virtual device.. update: I entered the internet on the Android's virtual device, tried to save an image, and it says that "An SD card is required". I t...

MediaMetadataRetriever.java on android unpublished API through Reflection

I'm interested in accessing this class: http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=media/java/android/media/MediaMetadataRetriever.java;h=681751b4d15115ffceb2c1d812b5d0f68b11a5ab;hb=HEAD It is android unpublished API but is it a problem if I access it through reflection or it could lead to issues ? ...

android as view layer of spring mvc

We are trying to convert one of our J2ee web application to android application. The idea is that android device will be kind of view layer of spring mvc. Basically the andoird application will invoke the controller on the server and the controller will respond with JSON to the android application. Kind of RESTfull way of doing it. Quest...

Android ant compile fails: java.lang.NoClassDefFoundError: com.android.jarutils.SignedJarBuilder

So I created my build.xml from scratch using the android utility: $ /opt/android-sdk-linux_86/tools/android create project --target android-6 --name Dash --path . --activity Main --package com.gtosoft.dash Then I try to kick off a compile, but it fails! $ ant release Buildfile: build.xml [setup] Android SDK Tools Revision 6 ...

Is there a way to disable copy/paste in a WebView?

Title says it all, is there a way to programmatically (through java or the layout xml, not javascript) disable copy and paste in the WebView control? ...

Is there any way to add tab layout without letting the activity to extend TabActivity?

I want to add tabs to the layout of my activity, but I don't want the activity to extend TabActivity. The example in http://developer.android.com/resources/tutorials/views/hello-tabwidget.html only gave example of subclass of TabActivity. Is there any way I can make it without extending TabActivity? Thanks. ...

How to do a modal notification window from launcher?

I would like to write an application/service that shows a modal notification window (Like how Handcent does the Quick Reply SMS window) instead of putting an icon into the notification tray. How would one implement this? ...