Authorprashant.koli

Share With Intents in Android

S

MainActivity : package com.example.shareintent; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.widget.Button; import android.widget.ImageButton; public class MainActivity extends Activity { @Override protected void...

Capture Active Screen in Android

C

AndroidManifest.xml : <?xml version=”1.0″ encoding=”utf-8″?> <manifest xmlns:android=”; package=”com.example.capturescreen” android:versionCode=”1″ android:versionName=”1.0″ > <uses-sdk android:minSdkVersion=”8″ android:targetSdkVersion=”17″ /> <application...

Android EditText TextWatcher

A

Android EditText TextWatcher Example TextWatcher This methods  will be called when the text is changed. Text Watcher Having Three Events. 1.beforeTextChanged 2.onTextChanged 3.afterTextChanged beforeTextChanged This means that the characters are about to be replaced with some new text. The text is  uneditable.   Use: when you need to take a look at the old text which is about to change...

Android ViewFlipper

A

Simple ViewAnimator that will animate between two or more views that have been added to it. Only one child is shown at a time. If requested, can automatically flip between each child at a regular interval. Activity Code : import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view...

Server Client Communication in android

S

In this tutorial we will make a TCP Connection. The server will be written in Java and the client will be written in Android. Actually it will be a very simple messenger client. A. Make the Server in Java 1.To create the server create a new project in Java and make a class called “TCPServer”. In this class put the following code: import javax.swing.*; import java.io.*; import java.net...

How to Detect USB connected or Not In Android

H

1.Create Android project and add this Broadcast Receiver class file into that project like: import android.content.BroadcastReceiver; import android.content.Context;import android.content.Intent; import android.widget.Toast; public class DetectUSB extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if(intent.getAction().equalsIgnoreCase(“android...

Send Email with pdf file attached in android

S

Add this code from where you want to send email: File externalStorage = Environment.getExternalStorageDirectory(); Uri uri = Uri.fromFile(new File(externalStorage,”mypdfFile.pdf”));                            Toast.makeText(getApplicationContext(),”exists”,Toast.LENGTH_LONG).show();                Intent sendIntent = new Intent(Intent.ACTION_SEND);              ...

Using Horizontal Custom ListView in Android

U

main.xml: <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”;    android:orientation=”vertical”    android:layout_width=”fill_parent”    android:layout_height=”fill_parent”> <TextView      android:layout_width=”fill_parent”      android:layout_height=”wrap_content”     ...

Category