android

Is there anything I need to take into account when repeatedly calling the same activity?

I am developing an app where a single activity is instantiated multiple times by itself. I guess you could think of it like a book where each activity is a page. At the end of the page (activity) the user presses a button to go to a new page. I fire off an Intent for the same Activity, but I push different data into the Bundle so that...

Activity to Activity Communication

Hi All Activity a =AssumeSomeActivityExists(); Intent openActivity=new Intent(); openActivity.setAction(Intent.ACTION_VIEW); openActivity.setClass(a,B.class); a.startActivity(openActivity); When we do something like above how to make B instance know that it is been called and created by Activity a? Thanks & Regards Sudhakar Chavali ...

Store the session of Facebook from WebView

Hi all, I'm trying to avoid that when a user has connected to Facebook from my webview, the next time he do it, doesn't need to put the email and password. I'm getting the cookie from the "facebook.com" domain with this sentence: String cookie = CookieManager.getInstance().getCookie("facebook.com"); and storing it in a SQLite database...

Android: How to dynamically include a XML Layout?

Hello, I want to decompose my UI into several XML Layouts. The first one would be the main layout, and the other ones would be the content layouts. I would like to be able to set which content_layout should be included dynamically during runtime, so I don't want to set a "layout="@+layout/content_layout" in my XML file. Here are my lay...

Using custom Android widget from one project in another

I'm attempting to use a custom Android vertical scrollbar widget that seems to work fine in its own example project, but I am having trouble trying to include it into my project. I've exported a .jar from it to use in my project, but it seems to be a minefield of problems, from duplicate resources, to my XML layouts not able to get at s...

How to modify ToggleButton behaviour with or without xml in Android

Hi, I've to do a memo card game in android for my project. As for now i'm at the stage where i try to figure out the basic shape of my app. I've read some tutorials, but i can;t figure out how to modify a lot of dynamically created buttons (ie. in 'for' loop), from xml, or even from the code. To make my question clear here's the code i ...

Android emulator unistalls application after the app is closed, but I need to test serialization

Hello, I am trying to implement serialization for an email application on the android (stroring username, password, server etc.), but in order to test it I have to close the application in the emulator and then re-open it to ensure that it looks and finds the file with the serialized objects. The problem is that when I close the appl...

Android layout problem

I have 2 TextView's in a horizontal LinearLayout. The LinearLayout fills the screen horizontally. How can I achieve the following behaviour: If the first TextView is too big, it is ellipsized at the end like this: [firstTextViewIsTooBig...|secondTextView] If the first TextView is not big, the layout should look like this: [firstTextV...

Validation on TextEdit boxes on android

Hi! I wounder if there is some different way of validating EditText on android controlls.. Or should I use the regular java way of doing this? ...

How to access position variable in onItemSelected()

In the following example, How would one access "position" variable from elsewhere (outside the parent class) : void onItemSelected(AdapterView parent, View view, int position, long id) { Country country = (Country) parent.getAdapter().getItem(position); spinner2.setAdapter(new ArrayAdapter(country.getStates()); } ...

NegativeArraySizeException in Android

Hi I am trying to run this code, but get an error. Can anyone tell me why? The debugger shows the following Thread [<3> main] (Suspended (exception NegativeArraySizeException)) ViewRoot.handleMessage(Message) line: 1704 ViewRoot(Handler).dispatchMessage(Message) line: 99 Looper.loop() line: 123 ActivityThread.main(String[]) lin...

Unzipping from SD card - filenotfound error - Android 2.2 SDK

I keep getting a file not found error, even though it exists at /mnt/sdcard/folder/Samples.zip. I downloaded the file there, so there are "write" permissions, but it just doesn't want to unzip! Why is this? ZipInputStream in = null; try { final String zipPath = "/folder/Samples.zip"; in = new...

Android phone can't see anything through VPN.

I have a Galaxy S (Android 2.1 Update 1), and a Windows 7 Pro machine configured to allow incoming connections (i.e the built-in PPTP VPN functionality). I can establish a VPN connection to the laptop from the phone however I can't ping it or access a simple HTTP service running on 8081. Windows Firewall doesn't seem to be the issue as ...

What should I use in Android when porting C++ code written with libsndfile?

I'm porting a small (<10 classes) C++ project to Java. The project manipulates sound files, and in C++ does this using libsndfile. The code includes stuff like: const int channels = audioFileInfo.channels; ... sf_readf_double( audioFile, inputBuffer, MAX_ECHO ); ... sf_writef_double( outputAudioFile, &currentAudioBuffer[WINDOW_SIZE * ch...

Image manipulation while on touch event is inefficient !

I have two images overlayed and i copy pixels from bottom image to top image while ACTION_MOVE. My goal is to give erasing feeling to the user but sometimes it doesn't copy(erase) some parts and it gets worse if touch event is fast( dragging finger fastly). This is the code i am using for copying pixels mutable.getPixels(pixels, 0, wi...

Logcat tab in Eclipse DDMS Persepctive (Android ADT plugin) Keeps Coming up Blank

I have seen this problem off and on while running the Eclipse (Galileo) under Fedora 11-13, whether the target is my device or an emulator. But now with my new device, the HTC T-Mobile G2 (Android 2.2), I see it much more frequently: I successfully download the app (complete with lots of Log.d() calls), the system successfully launches i...

How to remove input method from android's TextView context menu

I have a context menu on a TextView representing a user name in my app. When the context menu appears I want to have certain options such as "View Statistics" etc. The context menu is appearing fine and everything is working great except it's adding "Input method" to the context menu and I do not want it there. It's irrelevant to what th...

Android Emulator loading wrong density

I am trying to simply test my app under a QVGA setting, but 95% of the time when I run the QVGA emulator I created, it loads the resources associated with HVGA. I have custom bitmaps that I include in my app, so it's crucial for me to be able to verify the appearance. To see what the density was being treated as, I added the following c...

Are there Android phones that cannot be used for app development?

Is it true that ANY Android phone can be used for App development and testing? I'm trying to find some inexpensive off-contract hardware for development and testing of our Apps. I've found some devices I can buy New with No Contract for $150 to $300 (like the HTC Aria or the Huawei Ascend). Is there anything that would prevent me from ...

Android widget in emulator

I have an existing android app. I added a simple widget to it using the following: updated my manifest with a <receiver> block which provides information about my AppWidgetProvider implementation added a new xml files in res/xml with a <appwidget-provider> element that contains the height/width/updatePeriod/initialLayout/icon/label att...