Author name: Laura Prata

Info

My Applications

Here I will post the applications developed by us. 1. Number Series  Number Series is a logical game with numbers, just perfect for you if you like to challenge your brain. You have to go through 10 levels with varying degree of difficulty and you have only 3 lives to complete the game. What do

, ,
Tutorial

Android LayoutInflater Turorial

In this tutorial I will show you how to use the LayoutInflater in Android.1. Make a new project (I called my project InflaterExample and my main Activity it’s called “MyActivity”) 2. Go to res – layout – main.xml and put an id called “main_layout_id” <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:orientation=”vertical” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:id=”@+id/main_layout_id”> </LinearLayout> 3. Go to res

,
Snippets, Tutorial

Android Vibrate on Click

If you want to make the phone to vibrate when you click on a button from your application: 1. You have to declare in your AndroidManifest.xml the permission: <uses-permission android:name=”android.permission.VIBRATE”/> 2. Now go to the class you want to put the vibration and in onCreate put this code: final Vibrator vibe = (Vibrator) yourActivity.this.getSystemService(Context.VIBRATOR_SERVICE); //replace

, ,
Snippets, Tutorial

Android EditText text changes Listener

If you want “listen” to the text changes from an EditText you have to use the TextWatcher. Bellow I will show you an example of TextWatcher: //first, we create an EditText EditText answer = new EditText(this); //second, we create the TextWatcher TextWatcher textWatcher = new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int

, ,
Tutorial

Detect when Done key is pressed

If you want to detect when a key from soft keyboard is pressed, like Done key, you can use the following code: mEditText = (EditText)findViewById(R.id.edit); mEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { //verifies what key is pressed, in our case verifies if the DONE key is pressed if (actionId

, ,
sponsored
Exit mobile version