adjust the size of the parent layout

I have a simple linear layout and want to divide the screen into two equally sized parts. In the upper one, I want to put a SurfaceView that has exactly the same size as its parent, i.e. half of the screen. Unfortunately, it always either takes all t

Set imageview onclick of the current page in viewpager

Hello guys I am using viewpager in my application, On a page there is one imageview. on this image view i set onclick listener. When i am going to click on this imageview and change image on it, image of next page is get changed and current page imag

Why are not these TextViews next to each other?

I need to create multiple TextView dynamically next to each other. When I run the code below, the result is not what I expected. t1 and t2 are quite distant one from the other RelativeLayout journals = (RelativeLayout) findViewById(; layout

Passing Intent can not get extra ();

Hi i can't get logged in already in a web page at mine main activity i passed inten to another activity but i can't get an extract. How can i solve it this is mine main activity public class ViewActivity extends Activity { private EditText mTextUserN

Android alignment button by program

I have an Android button on a RelativeLayout which I want to animate. The animation is currently done with a ObjectAnimator to move the button 50dp up and down on a scroll event. The position of the button is currently calculated programmatically wit

Is it an Android library to load images and get http status?

I have an app where I use the library Ion ( The problem is I realized that I need to get the http-status when the loading fails. I have a rest-service returning different status depending on what went wrong, and need to

Android - Event after createView

I want to get width and height of my layout after it had been drawn. My code is actually called in the createView() method. But I want to wait until the layout is drawn before execute this code : Log.i(TAG, "Height: "+myButton.getHeight()+"

Sliding in the layout animation on android scrolling

I am trying to do a TranslateAnimation but don't work properly the layout apear and disapear but didn't do any animation. How could I solve this? The java code is this: private void initComponents() { ImageView postIV = (ImageView) findViewById(

What version of Android provided Screen Capture?

we want to let users to capture screen shot on our app , but thinking that some older version like 2.3 devices don't have Screen Capture function by default . So Screen Capture was provided since which version ? so that we can tell users about this .

How to detect double taps on ListView items in Android?

i want to do some thing like instagram app when user double tab on photo it make like and while he just tab one time it open as full screenI think this answers to Your question as well. Check this link: how to implement double click in android

Apache Http Client in Android

I'm trying to get the whole html from a web page in Android. In java console aplication I used to do like this: DefaultHttpClient httpclient = new DefaultHttpClient(); String busca = "kindle"; HttpGet httpGet = new HttpGet("http://www.amazo

AddAll Android Collections

I'm just starting out in java & android. Below is my code, to add all the buttons in an activity then hide them. Question: is their anyway to automatically add all the buttons in the activity without having to list each of them, I have looked at list

Android: SharedPreferences How to implement them correctly

I'm trying to store a user entry into an EditText field however when I exit the application it does not appear. So for example a user types in his/her name and then exits the application. When the user returns and launches the Application the users n

Start a new activity from the non-activity class

I want to start a new activity in non-Activity class that implements a DialogListener following is my code: public class FacebookLoginDialog implements DialogListener { @Override public void onComplete(Bundle values) { HomeActivity.showInLog(values.t

end method if empty editText

This is a tip calculator app in Java. If both fields are not filled in, it should show an error message in a TextView, but it just freezes the app... any tips? package tip.calculator; import android.os.Bundle; import; import andr

setRetainInstance fragment with the Android UI

Ok, I created a Fragment with some UI (couple textboxes and stuff) and I used setRetainInstance since Im running an AsyncTask to query a server (request can only be sent once) and I need the result of the AsyncTask. So my question is: Is it wrong to

How to make my connection an asyncTask connection

UPDATE: I found that the easiest way is to use AQuery. I need to get my HttpPost for getting JSON data on another thread and I dont know how to get it all working together. Ive looked at the Painless Threading Blog and still cant get it to work. Belo

How to delete the file saved on the SD card of the emulator?

In my application I am going to store the file from assets to the SDCard. But now there is no more space in the emulator. So I want to delete that file. So how to delete that file from the Emulator?Option 1: Go to Avd folder in Windows XP C:\Document

Android: multiple tables in custom ArrayAdapter

I would like to pass multiple arrays for my custom ArrayAdapter. Here's my arrays and what I want to do: String[] names = new String[]{ "One", "two", "three" }; String[] texts = new String[]{ "Bacon", "Eggs&quo

AsyncTask Force Close

Anyone know why AsyncTask is force closing when I try to unzip a file in the background, it works when not using AsyncTask so I'm not sure what I am doing wrong: public class UnzipFile extends AsyncTask<Void, Integer, String> { String zipFile = Envi

Threads and event management in Java

I am a Java newbie and an Android newbie too. I am working on a game and trying to understand the exact nature of events in Java and Android. I have a few questions to help understand the correct way to do event handling in my app. Its a network game

description of the android menu item

I know Java, but I am new to Android. I have a question, maybe it is simple but I have searched the web for the past 2 days and I`ve got nothing. I don't even know how it's called, that's why I have a link to an image photo and an example path to it

Android: nullpointer when saving images

I'm trying to take an image, optimize it as a 65% jpeg and save it to the phones storage. The code below is working fine for me on my nexus one, but is returning a null pointer exception on the last line. Any idea what I'm doing wrong? Thanks // imag

How can I get a .wav sound to play?

Im making an app, and i want it to make a sound when a activity is opened , the sound file is in R.raw.sound_file , if someone could do some example code to make my app play a sound that would be great.doesn't the class do t