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

HttpURLConnection Post Android

I am trying to use the tutorial here with the data I learned here to perform a HTTPUrlConnection POST Request. Every time I run it, the response gives the error message: "You Must enter a user name!" and "You must enter a password." Co

Button at the bottom of the screen

I have a layout that looks like this, <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical&quo

Unable to get current location Google Map Android

I know this question is similar to other question but i am unable to understand the procedure of getting my location in google map. I have tried lots of tutorials but i think i am missing something. I am using the following code in my main class : Lo

Connect to Android with the PHP web service

I want to make login with JSON. This is my login web service and my login activity in android studio. When i attempt to login it always response 1. It means it always success. Although the username and password is wrong. Can you tell me why is this h

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

{Need help !!} Google maps in Viewpager Fragment

Ive been trying to implement Google maps into a viewpager fragment, Ive followed many different tutorials but have fail miserably every time. If anyone has any incite into how to get something like this working i would be really happy!! below is the

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(R.id.main); layout

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()+"

Spring Rest Template The Put method is null, why?

Im using Spring Rest Template for Android, and am going to use the PUT method to update an method. But surprisingly the PUT methods ofter doesnt support parsing the result object, they are just void, how come? My understanding of proper REST support

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(R.id.

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 .

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

Problem with multiple asynchronous tasks

I am starting 6 asyncTasks at a time. But my problem is that how do I know that which async task's onPostExecute() is returned.IMO the best solution in this case is to pass some kind on callback to each of your AsyncTasks. Here's how it's done: Creat

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

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 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

Videos not displayed in GridView

After having solved every of my previous issues to get the code running for retrieving videos from the sdcard and displaying them in the GridView, I still cannot see the videos. I don't know what I have done wrong that they won't show and the array i

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 android.media.MediaPlayer class do t