Posts

Showing posts from January, 2013

Input Dialoge for android

Image
When you want to user give quick input then used input dialog in android . It design from dialog to change its type to input. private void inputDialog() { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("Please Enter File Name"); final EditText input = new EditText(this); alert.setView(input); alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // to get text use input.getText().tostring(); } }); alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // nothing to do when Cancel is pressed } }); alert.show(); } We write all input dialog code in separate method .

Android Single Item Selection Dialog

Image
Dialog are used for User Some piece of information for user that what you want to do, or user enter any wrong operation on system then dialog are displayed for output that you do any exceptional command . We used it for Selecting single choice and multiple option. We add single button when user click on this button Dialog will be displayed and select desired choice . Now we want to add src for java class code . where we add button clicked listener. When user clicked the button it will called showDialg() method. In showDialg() method we write the code snippet of Dialog and assign array of commandArray for multiple choice. import android.os.Bundle; import android.app.Activity; import android.app.AlertDialog; import android.app.Notification.Builder; import android.content.DialogInterface; import android.view.Menu; import android.view.View; import android.widget.Toast; public class MainActivity extends Activity { private String[] commandArray=new String[] {&

Create Alert Dialog in Android

Alert Dialog is used for Show information to user .Its also used for give user action output that what are performed . Following are the example of Simple Dialog. private void SimpleAlertDialog() { Builder builder = new AlertDialog.Builder(this); builder.setTitle("My Alert Dialog"); builder.setMessage("This is example of Simple Alert Dialog"); builder.setPositiveButton("OK ", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); AlertDialog alert = builder.create(); alert.show(); }

Notification For Android

Notification are used for Background task interaction with user. When you want to download , upload data to/from server . And you want to do other task in android phone then use notification manager helper class to provided time to time update for user to get the process state. We create you helper class hope you enjoy it. public class MyNotificationManager {     private Context mContext;    private int NOTIFICATION_ID = 0;   private Notification mNotification;   private NotificationManager mNotificationManager;   private PendingIntent mContentIntent;   private CharSequence mContentTitle;     private int icon=0; public MyNotificationManager(Context context, int iconState)   {     mContext = context;    icon=iconState;   }  public void createNotification(int id, String title) {     NOTIFICATION_ID=id;    //create notification manager    mNotificationManager = (NotificationManager)                                          mContext.getSystemService(Context.NOTIFICAT

SQlLite For Android

Here we add Sqlite Helper class. Which you can used an any project for permanently storage of necessary data. Customize it on base of your requirment. package com.example.smartftpclient; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; public class SqliteDataBase { private static final String DATABASE_NAME = "data"; private static final String DATABASE_TABLE = "reminders"; private static final int DATABASE_VERSION = 1; public static final String KEY_TITLE = "title"; public static final String KEY_PORT = "mode"; public static final String KEY_USER_NAME = "reminder_date_time"; public static final String KEY_PASSWORD = "reminder_date_time"; pub

GLSurfaceView in android

It used for 2D and 3D Graphic animation , gaming and all those app which required 2D or 3D Graphic Here we Simply Introduce skeleton of GLSurfaceView. Create New Project The Activity Class Look like the following public class GLActivity extends Activity  {    @Override    protected void onCreate(Bundle savedInstanceState) {                 super.onCreate(savedInstanceState);                setContentView(R.Layout.main); } This is our main activity onCreate() method. Now we make out project GLSurfaceView based Application So we Do this public class GLActivity extends Activity private GLSurfaceView glView;  {    @Override    protected void onCreate(Bundle savedInstanceState) {                 super.onCreate(savedInstanceState);                glView = new GLSurfaceView(this);                glView.setRenderer(new GLRenderer());                setContentView(glView) } Now We add the Renerer Class Which we used in GLSurfceView class GLRenderer implements GLSu

How to restore Deleted file in Eclipse

When you develop App and unfortunately some file are deleted from you and you want to recover at the used the following procedure To to Navigation Menu Select Open Resources Then Enter file or Project name which you want to restore. Click on Open Button  Now you File/Project are opened for you . Let Enjoy.............