Android Intent Service | Phone Vibration | Source Code Download

Android Intent Service

ANDROID

 

Android Program of Android Intent Service Vibrate Activity:

Making Phone to vibrate for 3 second: Android Program 

Android Intent Service       Android Intent Service

Java Code(VibrateAct)

import android.app.Activity;
import android.content.Intent;
import android.os.Vibrator;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

public class VibrateAct extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_service);
}

public void start(View v)
{
Vibrator vib = (Vibrator)getSystemService(VIBRATOR_SERVICE);
vib.vibrate(3000);
Toast.makeText(VibrateAct.this, “vibrate for 3 seconds”, Toast.LENGTH_SHORT).show();
}

}

Layout XML Code(activity_service)

<?xml version=”1.0″ encoding=”utf-8″?>
<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android”
xmlns:tools=”http://schemas.android.com/tools”
android:layout_width=”match_parent”
android:layout_height=”match_parent”
android:paddingBottom=”@dimen/activity_vertical_margin”
android:orientation=”vertical”
android:paddingLeft=”@dimen/activity_horizontal_margin”
android:paddingRight=”@dimen/activity_horizontal_margin”
android:paddingTop=”@dimen/activity_vertical_margin”
tools:context=”.VibrateAct”>

<TextView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:textSize=”@dimen/textsize”
android:layout_gravity=”center”
android:textStyle=”bold”
android:text=”VIBRATE SERVICE”
android:layout_marginBottom=”150dp” />

<Button
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:text=”VIBRATE”
android:layout_gravity=”center”
android:onClick=”start”
android:id=”@+id/button”
android:layout_marginBottom=”100dp”/>

<Button
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:text=”@string/sourcecode”
android:background=”@color/bgcolor”
android:textStyle=”bold”
android:textColor=”@color/text”/>

</LinearLayout>

 

Output :

Android Intent Service

 

Download Source Code Android Intent Service Phone Vibration  

Learn Android

Link1 – Complete Android Programs with Source Code Download

Link 2- Android Interview Questions for Freshers and Beginners

Link 3- MNC’s Jobs Vacancies 2018 

Link 4- Java Interview Questions for Freshers and Experience

Android Intent Service Android app development course for beginners 

 

Related Search

Android Intent Service example source code download, ANDROID, android app development course for beginners with source code download, android application development for dummies, android developer intent source code, android intent source code download, android intent activity code, android intent example, Android Intent Service simple example, android new activity source code download, android programming for beginners, android start activity, android start new activity, android studio intent, app development course for beginners, beginning android application development, explicit intent example code, getting started with android programming, intent android studio, intent filter, intent filter in android, Java android, java android tutorial for beginners, learning android programming for beginners, startactivity intent example

Leave a Comment

Comments

No comments yet. Why don’t you start the discussion?

    Comments