Wednesday 9 April 2014

Change Action bar title Font Style android

CHANGE ACTION BAR TITLE FONT STYLE

Step 1)

get the resource ID of android title

int actionBarTitle = Resources.getSystem().getIdentifier("action_bar_title", "id", "android");

Step 2)

Now
make object of text view and typecast the ID aquired above to textview object

TextView actionBarTitleView = (TextView) getWindow().findViewById(actionBarTitle);

Step 3)

make the folder  named fonts in assets and copy  any fontstyle.ttf file in that folder


Typeface forte = Typeface.createFromAsset(getAssets(), "fonts/FORTE.TTF");

Step 4)
 Give changes according to your need to the text view

if(actionBarTitleView != null){
            actionBarTitleView.setTypeface(forte);
            actionBarTitleView.setTextSize(25);

        }
 
Step 5)

Now set title for Action bar

getActionBar().setTitle("SAMPLE");

it will set the tile with the fontstyle u specified with textview object

COMPLETE CODE
copy and paste

    int actionBarTitle = Resources.getSystem().getIdentifier("action_bar_title", "id", "android");
        TextView actionBarTitleView = (TextView) getWindow().findViewById(actionBarTitle);
        Typeface forte = Typeface.createFromAsset(getAssets(), "fonts/FORTE.TTF");
        if(actionBarTitleView != null){
            actionBarTitleView.setTypeface(forte);
            actionBarTitleView.setTextSize(25);
        }
       
       
       getActionBar().setTitle("SAMPLE");


NOW run your app and see the changes



Sunday 16 February 2014

Top 5 E-books for Android Developers

Top 5 books For Android Developers


 1) Hello, Android (English)

 Authored by Ed Burnette, “Hello, Android” is a great tool to help you get started with your first Android application. Introducing the basics of Android development, you slowly start getting more conversant with this mobile platform.
The third edition presents examples of testing compatibility with the different features and versions of the Android OS.
Gradually, this book teaches you to develop more features into your app, such as audio and video support, graphics and so on. It also gives you a tutorial on publishing your app to the Android Market.
This book is definitely worth a look for those who are looking for a practical tutorial in Android development.


 2) Sams Teach Yourself Android Application Development in 24 Hours (English)

Learn Android app development in 24 sessions, devoting one hour for each session. This book teaches you common tasks in Android development and to design, develop, test and publish your app to the Android Market.
The “Quizzes and Exercises” section at the end of each chapter test your grasp on the subject. “By the Way” notes give you related information. The “Did You Know?” section offers you helpful tips along the way. The “Watch Out!” section helps you prevent common pitfalls.
You learn to work with Java, Android SDK, Eclipse and so on and to use Android’s built-in features to create user-friendly UIs for your Android app. Gradually, you also learn to integrate network, social and location-based features in your Android app.


3) Android Application Development All-in-one for Dummies (English)


 This book, as the name suggests, is for those who have never attempted coding for Android before. Authored by Donn Felker, it explains how to download the Android SDK and work with Eclipse in order to get your Android app running. Beginning with the very basics of Android development, it also teaches you how to price your app and submit it to the Android Market.
You start with working with the basic app development process, learning to work with Android’s features to design easy-to-use UIs. It teaches you about working with classes, databases, multiple screens, debugging, creating home screen widgets and so on. You also learn to use built-in Android conveniences to your advantage

4) Beginning Android Tablet Development



This book shows you how to get started with Android tablet programming, without prior experience. Educating you from the ground up, this tutorial enables you develop your own Android tablet apps, starting with Android 3.0 Honeycomb onwards.
This book teaches you to work with 2D programming, slowly moving on to a 3D
touchscreen interface with the Honeycomb SDK. Whether it is to develop a location-based app or create your first 2D or 3D Android game, this book takes you through a nice journey on basic Andriod tablet development.
This book also teaches you to move away from Java and explore other languages while working with the Android OS.

5) Professional Android 2 Application Development Book Review



This book teaches you to leverage all the features available in Android 2.0 onwards. The only condition here is that you should already know about the basics of Java programming, Eclipse and the like.
Starting with working on the basic Hello World examples, you slowly learn to develop more advanced apps with layouts, menus, UIs and other features. The ensuing chapters teach you to handle databases, location-based apps, widgets, network and radio connectivity features and such.
You are then introduced to create more sophisticated surface views, animations and other interactive controls, thereby enabling you to gain more confidence with Android app development.





Enjoy Coding ....!!!!!!!!!!!!!!!!






Monday 10 February 2014

ANDROID IMAGE CAPTURE FROM CAMERA AND DISPLAY TO

ANDROID IMAGE CAPTURE FROM CAMERA AND DISPLAY TO <IMAGEVIEW />
 

STEP1

CREATE activity_main.xml with following code

 <TextView
        android:id="@+id/text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="ImageFromCameraAndGallary" />
   
    <ImageView
        android:id="@+id/imgview"
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:layout_below="@+id/text"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        />
    <Button
        android:id="@+id/buttonClickImage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/imgview"
        android:text="Click Image"
        />

STEP2

CREATE MainActivity.java with following code

public class MainActivity extends Activity {
    private static final int CAMERA_REQUEST = 1888;
    public ImageView image;
    public Button button;
   
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
       
        image = (ImageView) findViewById(R.id.imgview);
        button = (Button) findViewById(R.id.buttonClickImage);
       
        button.setOnClickListener(new OnClickListener() {
          
            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                Intent camaeraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
                startActivityForResult(camaeraIntent, CAMERA_REQUEST);
              
            }
        });
    }
   
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        // TODO Auto-generated method stub
        if (requestCode == CAMERA_REQUEST && resultCode == RESULT_OK) {
            Bitmap photo = (Bitmap) data.getExtras().get("data");
            image.setImageBitmap(photo);
        } 
    }
}






STEP3

FINALLY give premission to use camera to our android app by giving permission in android.manifest.xml



<uses-feature android:name="android.hardware.camera"></uses-feature>








IT works  fine...