Learn Android for Free,issues for developers, mobengineers website provide complete solutions for developers issues posts.It also provides online training for android development

Wednesday, December 26, 2012

Setting Up Android App Development

Using existing IDE
 

Step 1: Setting Up the JDK Download JDK from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1637583.html

 Step 2: Download Eclipse and install download from http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/junor

Step 3:Setting Up the Android SDK download latest android sdk from developers.android.com

 step4: install adt plugin, which will provide the interface between eclipse and android sdk.

 Download SDK bundle with pre configured tools required for android app development

 http://developer.android.com/sdk/index.html#download

Sunday, December 16, 2012

Shasidhar googlegroups jobs

-->

Friday, December 14, 2012

Iphone Jobs

Home Android Jobs Iphone Jobs Jobs for All Friday, December 14, 2012 Iphone Jobs BNB Gamestudio hiring iphone developers exp: 0-1 Timing : 11:00 AM - 1:00 PM and 4:00 PM to 6:00 PM Interview Rounds 1st : Written Test (Technical, logical programs) 2nd : Face to face interview (Technical) 3rd : Face to face interview (HR) -->

Android Jobs (0-2yr exp)

Android Jobs (0-2yr exp) Deloitte Hiring freshers Software Developers (0-1 yr ) Role: Software Developer exp: 0-1 yr click here to apply online Click here to apply- Register here http://www.bnbinfotech.com/ -->

Wednesday, December 12, 2012

Online Training

write a email to us:
nsc462@gmail.com   
                  Android  Online Training

                              Android Course Content 
1. Core Java

 Object oriented Programming basics
 Introduction to OOPS
 Classes, Objects
OOPS features
Packages
Exception handling
MultiThreading
IO Streams

2. Introduction to Android                                                                                      
·        Overview of Android
·        History of Android
·         Android features, Versions
·        Android Architecture overview        
3. Setup of Android Development environment                                                      
  • Eclipse and SDK installation, AVD creation
  • Project Structure
  • Creating first Android application
4.Fundamentals
  • LifeCycle of Application
  •  Manifest File
  • LifeCycle of Activity
  • Layouts
5. Main Building Blocks                                                                                            
·        Activity
·        Intents
·        Services
·        Broadcast Receivers
·        Notifications
·        Dialogs
6. Resources                                                                                                                    
·        Overview of Android Resources
·        Creating Resources
·        Using Resources
·        Drawable Resources
·        Animation Resources
7. Data Storage                                                                                                                           
  • Shared Preferences
  • Internal Storage (Files)
  • External Storage(SD Card)
  • SQLite Databases 

8.Location Services
9. Others
Blue tooth
WiFi
Camera
TelephonyManager
Media player
10. Webservices
·        SOAP
·        XML , JSON parsing
·        Connecting to remote server
11.Debugging Android Application
12.  Realtime Project



Contact us for online training

email: nsc462@gmail.com

mob: 91 -9704132390

country code: 91

COURSE FEE: $550

Saturday, November 24, 2012

Graphics

Graphics in Android


Android API provides allow to draw custom graphics onto a canvas or to modify existing views to look good.

 We we draw graphics, we can do it in 2 ways.

1. draw the graphics into a view object from layout.
2. draw the graphics directly to the Canvas.

To draw something, we need 4 basic components.

1. A Bitmap to hold the pixels.
2. A canvas to host the draw  calls- writing into the Bitmap.
3. Draw primitive- like draw rectangle, text, path etc.
4. Paint- describes the colors and styles to draw.


Bitmap to hold the pixels:

It's a simple example to draw a bitmap on screen in View. The content view is set to a View, and the drawing is achieved in onDraw method.
To draw a bitmap on screen in View, Content view is set to view and dwaing is get in onDraw().

 A canvas to host the draw  calls- writing into the Bitmap:
Canvas works as interface to actual surface upon which graphics will drawn.
It holds all "draw" calls.With canvas, drawing is actually performed underlying Bitmap, which is placed into Window.

 Bitmap bm=BitmapFactory.decodeResource(getResources(),R.drawable.image);

canvas.drawBitmap(bm,0,0,null);


To draw color
 canvas.drawColor(Color.WHITE);

here is the simple example program

package com.srinivas.graphics;

import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.view.Menu;
import android.view.View;

public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(new NewView(this));
    }
   
   
    private class NewView extends View
    {

        public NewView(Context context) {
            // TODO Auto-generated constructor stub
            super(context);
        }

        @Override
        protected void onDraw(Canvas canvas) {
            // TODO Auto-generated method stub
            super.onDraw(canvas);
            Bitmap bm=BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
            canvas.drawBitmap(bm, 0,0, null);
        }
    }
}


download source code here
http://www.4shared.com/zip/9wuEVziV/GRaphics.html?

SurfaceView

it is a subclass of View. By using this we can draw surface within the View hierarchy.



The SurfaceView is a special subclass of View that offers a dedicated drawing surface within the View hierarchy. The aim is to offer this drawing surface to an application's secondary thread, so that the application isn't required to wait until the system's View hierarchy is ready to draw. Instead, a secondary thread that has reference to a SurfaceView can draw to its own Canvas at its own pace.
To begin, you need to create a new class that extends SurfaceView. The class should also implement SurfaceHolder.Callback.


Friday, November 23, 2012

jobs@ Android


Urgent Requirement for Android Developers for Hyderabad Location 

Experience Range            :               0-5 Years



send resumes to

anupamareddy@celebron.com


About SIMFORM 

We are rapidly growing software solutions company based in Ahmedabad with primary client base in North America. We are developing couple of cloud software, providing web solutions to client round the globe and at the same time we provide top class small business web design services to clients in North America.
We are in our development stage but, promise our employees healthy and comfortable work conditions and a promising career at the same time.

Why to work @ Simform ? 

Employee-friendly company environment
Working days : Monday to Friday 
Flexible work hours
Attractive Salary Package, Incentives for top performer of month

JOB DESCRIPTION

Designation Offered: IPhone Applications Developer 
Department: Mobile Applications Development 
Qualification: B.E./B.Tech/M.E./M.Tech/ 
Experience: 1 yr + 
Reporting to: PM 

Roles & Responsibility: 
1) Understanding the project requirement 
2) Understanding the project requirement 
3) Able to code the projects with efficiency 
4) Testing the applications and ensuring the programs and applications do not have glitches, 
errors, or low functionality. Fixing bugs, if any. 

Knowledge/Skills/Ability : 
1) A systematic approach to application integration 
2) Defensive coding ability accompanied with strong analytical and creative problem solving skills 
3) Knowledge of Xcode, Objective C, Sqlite, Core Data, Webservice, APNS, Local notification, 
Calender, Facebook/Twitter integration, Graph, Barcode/QR code, Audio/Video streaming, Core 
Location, ePub/PDF programming, Basics of core graphics 
4) Knowledge of game development, iTunes connect and Keychain is desirable 
5) Strong OOPS concept, and knowledge of database and SDLC compulsory.



Urgent requirement for "Trainee Software Developer" -- Java & J2EE

Required Technical skills:
J2SE, J2EE, Servlets, JSP, Struts, SQL, XML, HTML, JavaScript

Eligibility : BE/BTech/MCA
Location: Hyderabad

Desired Candidate Profile:
* Candidate should have good verbal and written communication skills.
* Willing to relocate.

Interested candidates share your updated profile on hr.unijobz@gmail.com
Seo Directory List

Monday, November 19, 2012

Fragments in android

Fragments represent behavior in particular portion in an activity.
Fragments must embedded in an activity and they cannot run independently without activity.
fragments having its own life cycle like activity life cycle.
To create fragement, we have to create a sub class of fragment.
Fragments introduced from android 3.0(HoneyComb) onwards
It contains callback methods similar to an activity such as   onCreate(), onStart(),onPause() and onStop().  


Fragment Lifecycle:

onCreate()    -     system calls when creating a fragment.Initialize components here.
onCreateView()-     system calls when the fragment to draw its user interface for 1st time.
onPause()     -     system calls when the user is leaving the fragment.
onAttach()    -     it is called when the fragment is associated with activity.
onActivityCreated()- it is called when the activity's onCreate() is returned.
onDestroyView()    - it is called when view hierarchy associated with the fragment is removed.
onDetach()         -it is called when the fragment is detached from the activity.

Apart from this we have several call back methods.

Wednesday, November 14, 2012

BroadCast Receiver

It class which extends BroadCastReceiver.  
which is registered in the android app via manifest file.

This class can be able to recieve intents via sendBroadcast()

BroadCast Receiver defines the method  onReceive(). only during this method , your BroadCast Receiver object will be valid.


ex: public class PhoneReceiver extends BroadcastReciever
{

@override
public void onReceive()
{
}
}

Tuesday, November 6, 2012

Upload file to server FTP

Class FTPClient
java.lang.Object
  extended by org.apache.commons.net.SocketClient
      extended by org.apache.commons.net.ftp.FTP
          extended by org.apache.commons.net.ftp.FTPClient


 public abstract class SocketClient extends Object


1. SocketClient provides the basic operations that are required of client objects accessing sockets. It is to be subclassed to avoid to rewrite the same code over and over again to open a socket, close a socket, set time outs etc.
2.setSocketFactory method, which allows you to control the type of Socke,the SocketClient creates for initiating network connections.

3. you could create a SocketFactory that requests browser security capabilities before creating a socket. All classes derived from SocketClient should use the _socketFactory_  member variable to create Socket and ServerSocket instances rather than instantiating them by directly invoking a constructor

4. The user will always be able to provide his own Socket implementations by substituting his own SocketFactory.

protected  void connect(InetAddress host)

Opens a Socket connected to a remote host at the current default port and originating from the current host at a system assigned port.

protected  void disconnect()
 Disconnects the socket connection.



public class FTP extends SocketClient


1. FTP provides the basic the functionality necessary to implement your own FTP client. It extends org.apache.commons.net.SocketClient since extending TelnetClient was causing unwanted behavior (like connections that did not time out properly).
2.  The FTPClient class, derived from FTP, implements all the functionality required of an FTP client. The FTP class is made public to provide access to various FTP constants and to make it easier for adventurous programmers (or those with special needs) to interact with the FTP protocol and implement their own clients. A set of methods with names corresponding to the FTP command names are provided to facilitate this interaction.
 3. You should keep in mind that the FTP server may choose to prematurely close a connection if the client has been idle for longer than a given time period (usually 900 seconds).
4. The FTP class will detect a premature FTP server connection closing when it receives a FTPReply.SERVICE_NOT_AVAILABLE  response to a command. When that occurs, the FTP class method encountering that reply will throw an FTPConnectionClosedException . FTPConectionClosedException is a subclass of  IOException  and therefore need not be caught separately, but if you are going to catch it separately, its catch block must appear before the more general  IOException  catch block.

5.  When you encounter an FTPConnectionClosedException , you must disconnect the connection with disconnect()  to properly clean up the system resources used by FTP. Before disconnecting, you may check the last reply code and text with getReplyCode , getReplyString , and getReplyStrings.

6. You may avoid server disconnections while the client is idle by periodicaly sending NOOP commands to the server.
 Rather than list it separately for each method, we mention here that every method communicating with the server and throwing an IOException can also throw a MalformedServerReplyException , which is a subclass of IOException. A MalformedServerReplyException will be thrown when the reply received from the server deviates enough from the protocol specification that it cannot be interpreted in a useful manner despite attempts to be as lenient as possible.


static int BINARY_FILE_TYPE

 A constant used to indicate the file(s) being transfered should be treated as a binary image, i.e., no translations should be performed.


static int BLOCK_TRANSFER_MODE
           A constant used to indicate a file is to be transfered as a series of blocks.

static int  TELNET_TEXT_FORMAT

A constant used to indicate a text file contains format vertical format control characters.


Ex:

 import org.apache.commons.net.ftp.FTPClient;
 import java.io.FileInputStream;
 import java.io.IOException;

 public class Main {
   public static void main(String[] args) {
     FTPClient client = new FTPClient();
     FileInputStream fis = null;

     client.connect("www.mobengineers.com");
     client.login("srinivas", "android");

     String filename = "mobengineers.dat";
     fis = new FileInputStream(filename);
     client.storeFile(filename, fis);
     client.logout();
     fis.close();
   }
 }







source:
http://commons.apache.org/net/api-3.1/org/apache/commons/net/ftp/FTPClient.html#storeFile(java.lang.String, java.io.InputStream)

Monday, October 29, 2012

Service in android

Activity is a foreground process. It contains user interaction. To run long running operations, we have to create a service.It will run in background. It does not contain user interaction.

Types of services:

1. Unbound Service: it runs in the background indefinitely even started activity with service ends also.
2. Bound Service : it will run till life time of activity.

 Activity can start service via startService()and it will stop via stopService().
If activity want to interact with service,it can use bindService().

first onCreate() is called, after onStartCommand is called with the intent data provided by the activity.


Android provides many predefined services exposed via Manager class.


Own services must be declared in the manifest file..


Some methods:

An activity can start a service via startService() method.

stop the service by using stopService() method.

bindService() - this is for activity to interact with service.

it needs "ServiceConnection" object.


Once service is started    onCreate()  is called.
onStart()



onBind()- the system calls when other component want to bind the service.

onStop() - for stopping the service.

OnDestroy()- called when service is no longer used. and it is destroyed.



Own services must be declared in manifest file.

how to declare own service:

<service android:name="your class"></service>
implementing class must extend the class   " service or one of its subclasses.


Ex: AsyncTask:
using services in android allows to have app running inthe background. if u want to do a simple task run in the background, use AsyncTask.

AsyncTask class:


private class someclassname extends AsyncTask<x,y,z>

protected void onPreExecute()
{
// starting new thread i.e    initilizing


protected void doInBackground()

// perform the action or do the task


protected void onPostExecute(){
// closing the process
}


 Example:

MainActivity.java
package com.example.servicetest;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;

public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        startService(new Intent(this,ServiceAct.class));
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
}


ServiceAct.java
package com.example.servicetest;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;

public class ServiceAct extends Service{
    String tag="service tag";
    @Override
    public IBinder onBind(Intent intent) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public void onDestroy() {
        // TODO Auto-generated method stub
        super.onDestroy();
        Log.d(tag, "service destroyed");   
    }
   
@Override
    public void onStart(Intent intent, int startId) {
        // TODO Auto-generated method stub
        super.onStart(intent, startId);
        Log.d(tag, "service started");
        stopSelf();
    }}

manifest permission

<service android:name="ServiceAct" />

Tuesday, October 23, 2012

Camera:

in android, we can access camera from app by 2 ways.

implicit intent launches default camera

Intent i=new Intent("android.media.action.IMAGE_CAPTURE");
startActivity(i);
permission in manifest.xml


<uses-permission android:name="android.permission.CAMERA"/>


 Button b=(Button)findViewById(R.id.button1);
        b.setOnClickListener(new OnClickListener() {
           
            public void onClick(View v) {
                // TODO Auto-generated method stub
                 Intent  i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
                    i.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
                    startActivityForResult(i, cameraData);
            }
        });



Other way is creating Camera class


camera class: to access camera hardware
SurfaceView class : dedicate a drawing surface at lowest level of the view as a placeholder to display the camera preview before describing how these are tied together and the layout structure we have to declare.



















WifiManager

java.lang.object

-  android.net.wifi.wifimanager

WifiManager class provides primary api for managing all aspects of wifi connectivity.

get the instance of this class by calling

contaxt.getSystemService(context.WIFI_Service);

it deals with list of configured networks. this can be viewed, updated.


check wifi status:

ConnectivityManager conMgr;
NetworkInfo netInfo;
WifiManager wifiMgr;

conMgr=(ConnectivityManager)getSystemService(context.WIFI_Service);
netInfo=conMgr.getActiveNetworkInfo();
if(!(netInfo==null))
{
if(WifiMgr.isWifiEnabled())
{
//wifi  enabled
}
else
{
//wifi disabled i.e not available
}
}







WifiManager in Android

java.lang.object

-  android.net.wifi.wifimanager

WifiManager class provides primary api for managing all aspects of wifi connectivity.

get the instance of this class by calling

contaxt.getSystemService(context.WIFI_Service);

it deals with list of configured networks. this can be viewed, updated.


check wifi status:

ConnectivityManager conMgr;
NetworkInfo netInfo;
WifiManager wifiMgr;

conMgr=(ConnectivityManager)getSystemService(context.WIFI_Service);
netInfo=conMgr.getActiveNetworkInfo();
if(!(netInfo==null))
{
if(WifiMgr.isWifiEnabled())
{
//wifi  enabled
}
else
{
//wifi disabled i.e not available
}
}







TelephonyManager

java.lang.object
android.telephony.TelephonyManager

it provides access to the info about telephony services.
we can register services to receive notification of telephony state changes.


context.getSystemService(context.TELEPHONY_SERVICE);


SOME METHODS:

public int getCallState()-    get the call state

public cellLocation getCellLocation()- returns current location of the device.. returns null if the current location not available.

this requires permission in the manifest file.

what permissions we need to declare:

ACCESS_COARSE_LOCATION
ACCESS_FINE_LOCATION

some more methods:

we can get device id


public string getDeviceId()

we can get network operator

public string getNetworkOperator()


we can get sim operator name

public string getSimOperatorName()







Bluetooth in Android



package:
import package:
import android.bluetooth.*;

<uses-permission android:name="android.permission.BLUETOOTH"/>
 for more advanced bluetooth tasks , like setting name, connecting....

<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>


ACCESS THE BLUETOOTH ADAPTER

Android bluetooth apis include bluetooth adapter class.
if we want to perform any action
BluetoothAdapter class must be instantiated.

BluetoothAdapter bluetooth=BluetoothAdapter.getDefaultAdapter();
if(bluetooth!=null)
{
// work with bluetooth
}
else
{
//disabled// switch on bluetooth
}



for displaying name of bluetooth

String status;
if(bluetooth.isEnabled)
{
String mydeviceaddress=bluetooth.getAddress();
String mydevicename=bluetooth.getName();
status=mydeviceaddress+:+mydevicename;
}
else
{
status="bluetooth is not enabled"
}



}


setting name
bluetooth.setName("Mydevice");







Pending Intent in Android


Pending intent is a token to the other application, which allows the other application to use your application’s permissions to execute a predefined piece of code.
Here other applications means  it may be an alarm manager, home screen widget manager etc......

To perform a broadcast via a pending intent, so get a pendingIntent via PendingIntent.getBroadcast().
To perform an activity via pending intent, you receive the activity via PendingIntent.getActivity.

Notifications -Toast, Dialogs,Statusbar Notifications


 Notifications:
toast notification
statusbar notification
dialogboxes

Adding sound
notification.defaults|=Notification.DEFAULT_SOUND;


Adding Vibration:

notification.defauls|=Notification.DEFAULT_VIBRATE;

adding flash lights:
notification.defauls|=Notification.DEFAULT_LIGHTS;


dialog is small window on the screen. when dialog is executed the activity losses its focus and dialog gets total control of app.

android.app. dialog package


alert dialog
progress dialog
date picker dialog
time picker dialog


alert dialog: it is a small window. it contains 0,1,2 or 3 buttons combination.It contains max 3 buttons like +ve ,-ve, neutral buttons.



Progress  Dialog:

its an extension of alert dialog class that can display progress animation in the form of spinning wheel.











Saturday, October 20, 2012

Service in Android




 MainActivity.java
package com.example.serviceexample;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity implements OnClickListener {
            Button b1;
            Button b2;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
       
         b1=(Button)findViewById(R.id.button1);
         b2=(Button)findViewById(R.id.button2);
        b1.setOnClickListener(this);
        b2.setOnClickListener(this);   
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }

     public void onClick(View v) {
                        // TODO Auto-generated method stub
                        switch(v.getId())
                        {
                        case R.id.button1:
                                    startService(new Intent(this,ServiceDemo.class));
                                    break;
                        case R.id.button2:
                                    startService(new Intent(this,ServiceDemo.class));
                                   
                        }
            }
}


 ServiceDemo.java
package com.example.serviceexample;

import android.app.Service;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.IBinder;

public class ServiceDemo extends Service{
     
      MediaPlayer mediaplayer;

      @Override
      public IBinder onBind(Intent arg0) {
            // TODO Auto-generated method stub
            return null;
      }

      @Override
      public void onCreate() {
            // TODO Auto-generated method stub
            super.onCreate();
           
            mediaplayer=MediaPlayer.create(this, R.raw.newsong);
      }

      @Override
      public void onDestroy() {
            // TODO Auto-generated method stub
            super.onDestroy();
            mediaplayer.stop();
      }
      @Override
      public void onStart(Intent intent, int startId) {
            // TODO Auto-generated method stub
            super.onStart(intent, startId);
            mediaplayer.start();
      }
}

Declare manifest permission for service

 <service android:name="ServiceDemo"></service>



you can download source code here

http://www.4shared.com/rar/O39SukJ_/ServiceExample.html?



20% off

Online Training

Your Name :
Your Email: (required)
Your Message: (required)

NDTV Gadgets360

Powered by Blogger.

Recent Posts

Find Us On Facebook

Popular Posts