Snippets, Solutions, Tutorial

Android Add Views into a ViewGroup Dynamically

As Android developer you will surely  need someday to add views dynamically, instead of creating a ListView. I will show you in this tutorial how to do this :) 1. Create a new project and call your activity “MyActivity” 2. Go to res – layout – main.xml and put the following code: <?xml version=”1.0″ encoding=”utf-8″?> <ScrollView […]

, , , , , , ,
Snippets, Solutions

AES CB encryption in Android using key and salt

Here is a simple example of AES CB encryption in android using key and salt. I am not expert in encryption but I found how to do this pretty hard and I thought that maybe it will help somebody else if not , it will help me latter again :). // decryption method public static

, , , , , ,
Snippets, Solutions

SQLite Query For Dates Equals To Today

Let’s start with an example: We have a table called StartDate with some dates stored into it as long (milliseconds) like in the image below: To understand better which date represents each record I will write below their dates: 1. Tuesday, February 5, 2013 8:10:17 PM GMT 2. Friday, February 1, 2013 8:10:17 PM GMT 3. Wednesday, February

, , , , ,
Snippets, Solutions

Android Stop Edit Text From Gaining Focus When Activity Starts

In this tutorial I will show you how to make the edit text not gaining focus when the activity starts. Sometimes this auto-focus can be annoying because the keyboard shows up even if we do not want to write something into our edit text. But let’s see what should be done in order to get

, , ,
Snippets, Solutions

Android change indeterminate progress bar(wheel) color

There are times when you want to add a progress bar(wheel type) on a white background and you notice that on some phones the progress bar has white color and is not visible… The issue can be fixed if you apply a color to your progress bar drawable. Here is how you can do it:

, ,
Tutorial

Android Custom States for State List

In this tutorial I will show you how to make some custom states which will be used on an ImageButton. Of course, this states could be used for edit text and other too, but in my example I will use ImageButton :) 1. After you create a new project with the main activity called “MyActivity”

, , , , ,
Tutorial

Android How To Pull Out The Database

In Android you can pull out the database only from emulator (you could pull out the database from a phone/device only if it is rooted). So if you want to pull out the database from emulator you should use ddms (ddms is located in Android sdk folder e.g. my Android folder is installed ProgramFiles so

, , ,
Snippets, Solutions

Android WebView Load URL Ignoring SSL

In this tutorial I will show you how to make a request to an URL. This tutorial might help you also, if you encountered the “Blank Page” problem (I have encountered this issue when I was trying to make a request to a secure http (“https”)). 1. Create a new project and call your java class(the

, ,
Snippets, Solutions

Android HttpResponse content(body) to String

Usually I use the following code to convert a Http response content to String:   BufferedReader in = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); StringBuilder responseBuilder = new StringBuilder(); String line = “”; while ((line = in.readLine()) != null) { responseBuilder.append(line); } in.close(); Log.e(“WS RESPONSE”, responseBuilder.toString()); It is not a bad idea but I found over the internet that

, , , ,
Solutions, Tutorial

Android Hide Soft Keyboard and Show Soft Keyoard

In this tutorial I will present you how to hide the android soft keyboard and how to show it too. You might need to hide the keyboard, if, for example, you will have to put a limit of characters that can be introduced into the EditText and want to hide the keyboard when  the number

, ,
Snippets, Solutions

Android ExpandableListView Scroll to Expanded Group Position

Once I had this problem: I had an ExapandableListView with groups and children. When I wanted to expand a group the list was scrolling to the end every time. After a little search I’ve figured it out what the problem was. In my xml file where my ExpandableListView was created, I had this attribute: android:transcriptMode=”alwaysScroll”

, , ,
Solutions, Tutorial

Android Multi-Touch: Two Fingers Tapping Once

For my project I had to add a feature where the user should use two fingers and tap with both of them at the same time in order to show view.  this behaviour is not very common on Android but I had to implement it anyway. So after I did some research,  and tried multiple

, , , ,
Scroll to Top