Blocking Incomming Calls in Android Smart Phone

We want to blocks all incomming calls in android phone. Create new project and extand it main class from BroadCast Receiver. public class Blocker extends BroadcastReceiver { private ITelephony telephonyService; private String incommingNumber; private String incommingName=null; @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub Bundle b = intent.getExtras(); String state … Read more

Timer in Android

public class Timer extends Activity { private TextView tv; private int cc=0; private java.util.Timer timr; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_timer); tv=(TextView) findViewById(R.id.textView1); timr=new java.util.Timer(); timr.scheduleAtFixedRate(new TimerTask() { @Override public void run() { // TODO Auto-generated method stub TimerMethod(); } }, 0, 1000); } public void TimerMethod() { this.runOnUiThread(new Runnable() { public void … Read more

How to read all contacts of android phone

In this tutorial we simply display the name of all Contacts which are saved at our phone . package com.example.contactslist; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract; import android.provider.MediaStore; import android.app.ListActivity; import android.database.Cursor; import android.view.Menu; import android.widget.Toast; public class Contacts extends ListActivity { private String name; private String phone; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); … Read more

Content Provider to load all images in Set as wallpaper in Android

res/layout/main.xml sec/java/mainactivity.java ….package com.example.allimagespath; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.app.Activity; import android.app.WallpaperManager; import android.content.ContentResolver; import android.content.Context; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.util.Log; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.Toast; public class MainActivity extends Activity { ArrayList … Read more

Customized Query to access Contents of android phone

Cursor cursor = managedQuery(Uri, null, null, null, null); First parameter are used for what you want to access there are built-in Uri used to access desired contents. Browser.BOOKMARKS_URI  Browser.SEARCHES_URI CallLog.CONTENT_URI MediaStore.Images.Media.INTERNAL_CONTENT_URI MediaStore.Images.Media.EXTERNAL_CONTENT_URI  Settings.CONTENT_URI  2. Second parameter is called projection. In this parameter of managQuery we want to retrieve how many columns . For Images String[] … Read more

Content Provider in Android

An android we used File , Data Base for Stored data permanently. These file and Database are accessible only to its application . Others application and packages can not access this. There fore android provide Content Provider  to shared data among packages and application. Some android shared contents are following Contact Number  Media Storage (audio, … Read more

Play Audio in Android

There are used Media Player class for playing audio file in android Programmatically . You can play audio file of your resource folder or play any file from Sd Card. Both method are describe below  Playing from resources Playing from res/raw/file.mp3 MediaPlayer player=MediaPlayer.create(PlaySound.this, R.raw.zara_se.mp3); player.start(); If you want to stop the audio use the following … Read more

Android Content Provider

Content Provider used for  Shared data of Android Mobile  . Which are easily accessible from every Application of Android. Following are the example of Shared data.  Mobile Contacts Browser Bookmarks Media Storage (images, audio and Videos) First of all we studies Built in Content Provider.