Sunday 26 June 2016

Make Splash Screen with Animation Android Application


https://dedyyuristiawan.blogspot.com


Hello world. Today i wanna show how to create slash screen with animation in android apps. In this post i am use small to big to small animation, you can see in demo apps. I am using last android studio and lollipop minimum sdk. lest do this.

First important thing if you want to make splash screen is logo, this is important for you and make your logo to png file, cause it can be our android apps runs fast. Splash screen its a activity so we make first activity for splash screen. This is important code in screen activity.

new Handler().postDelayed(new Runnable() {
 @Override
    public void run() {
        Intent i = new Intent(SplashScreen.this, MainActivity.class);
        startActivity(i);
        finish();
    }
}, SPLASH_TIME_OUT);

So the purpose for this function is before we move to another activity (main activity class), the screen activity will hold until splash_time_out done. splash_time_out is integer variable. In this case i set 3000 it mean 3 second. Yup its purpose we make hander in splash screen activity.

Whats about xml layout? in xml layout i just put image and text, and image and text i will make animation. Actually this layout is similar with another layout, you can see in the my demo code.

The second thing i wanna make animation in the splash screen. So this is my important code in splash screen activity.

protected void onResume() {
    super.onResume();
    logo_holder.startAnimation(anim_logo);
    Handler handler = new Handler();
 Runnable startMain = new Runnable() {
  @Override
  public void run() {
   if (!isFinishing()){
    text_holder.startAnimation(anim_txt);
   }
  }
 };
 handler.postDelayed(startMain, 200);    
}

 The purpose onResume function is make logo_holder to start animation (anim_logo is code xml i put in the anim folder on res) and then after image done for the animation, text will be show after image done, see in condition (if finishing). 

You can download my source code bellow, after this you can see my code and understand it, if you still confuse about code, you can write comment bellow. Thanks.

Source Code Github
Share:

Thursday 23 June 2016

How to Get Number From Contact Uri or Id Android


https://dedyyuristiawan.blogspot.co.id


Hello world. Today i wanna show you, how to get number from contact uri for develop android app. I write this post because yesterday i got problem when i want to get number from contact uri. Now i have solution to solve this problem. Yoyoy lets do this.

So yesterday i found library for show a name from the contact, but this library it just show name not a number, and i want to get number if i click name contact from list. In my context is i just have contact uri, so how can i get number from the contact ? after i find from the google , i wrap it to function. This is my function getNumber.

private String getNumber(int id){
    String strid = Long.toString(id); // convert id to string
    String phoneNumber=""; // create variable
    Cursor cursor = getActivity().getContentResolver().query(
    ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
    null,ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ?",
    new String[]{strid}, null); // Query for get record from id
        if(cursor.moveToFirst()){
            int phoneColumn = cursor.getColumnIndex("data1");
            // get number from first index
            phoneNumber = cursor.getString(phoneColumn);
            // get string from from number
            Log.d("DATA",phoneNumber);
            // test log, check its right number ?
        }
    return phoneNumber; // return number
}

And i call my function like this.

getNumber(Integer.valueOf(contact.contactUri.getLastPathSegment())
// getLastPathSegment its for get id from contact uri
// convert to int

Yoyoy this my fuction to get number from id number. The conclusion is  if you have just contact uri you can use this 'getLastPathSegment()' function for get id, and then from the id you can get number from my function. If you have confuse about my post you can write comment bellow, i hope i can help you more. Thanks.
Share:

Create First Android Application with Android Studio


https://dedyyuristiawan.blogspot.com


Hello world. Today i will show you how create first android apps / application with android studio. Now i am use mac operating system for develop apps. Basically create android apps its so easy if you have basic programming language, for specifically Java Programming. I suppose you if you want to develop android apps, please use android studio, latest update SDK. If you have everything like that it can help you to develop android apps something like reduse minimum issue, beautiful design, and know news update about android. Yoyoy we can start now step by step.


1. Install Latest Java JDK Version

You can download here in oracle. I suppose you to download and install latest version because we can reduce minimum issue for android studio and support for android studio work fine.

2. Install Android Studio Version

You can download android studio here in developer android studio. Again i suppose you to download and install because we can reduce issue (android studio its still young), make beautiful design and develop android app with last operating system. You can follow step by step to install whenever in mac, windows and linux in there. 

3. Install Last SDK

In the third step you can install all sdk in android studio. Pick Configure > SDK Manager > Launch Standalone SDK Manager, and install everything in there if you want easy to develop android apps, no more issue. After that your ready to develop android apps.

3.  Hello World Project

Open you android studio and pick start a new Android Studio Project.


https://dedyyuristiawan.blogspot.co.id
First Screen Android Studio Menu


First Screen write your application name. Pick Location that you want save your android project. Click next

https://dedyyuristiawan.blogspot.co.id
Write Android App Name


Second screen just pick minimum sdk (its minimum os android for your android apps). After that you can choose version that you want to develop whenever in Phone and Tablet, Wear, Tv, Android Auto, Glass. Click next.

https://dedyyuristiawan.blogspot.co.id
Choose Target Android App


Third screen you can pick layout whenever its basic activity, empty activity etc. In this post i will choose empty activity. And then click next.


https://dedyyuristiawan.blogspot.co.id
Choose App Template Screen



Fourth screen just let all default, click finish, and wait. Its just name for java file and xml file. i will guide to learn structure about android project.


https://dedyyuristiawan.blogspot.co.id
Write Name Java Xml File


Now you can run your android project. But before we run project i will set user interface android so we can understand so easily about structure android project.  Pick android and choose project.


https://dedyyuristiawan.blogspot.co.id
Change Project UI Screen


and stucture android project will be like that.


https://dedyyuristiawan.blogspot.co.id
Project UI Easy to Undersatand


In java folder its for we write java code and logically android project runs. File MainActivity.java its for runs xml file look this code.

setContentView(R.layout.activity_main);

Move to xml file, you can move to res folder > layout > activity_main.xml. Look from the top from default xml had relative layout and text view. Textview its for show with text  'Hello World' in screen android, you can look in preview screen

android:text="Hello World!"

https://dedyyuristiawan.blogspot.com
Xml Hello World


There is another folder that you can use its drawable folder. In this folder you can put image, xml file and etc i will tell you more in next post.

Mipmap folder its for image for with different dimension to fix screen in android phone. For example default its ic_launcher.png its a logo android app. You can look when android project run.


https://dedyyuristiawan.blogspot.co.id
Mipmap Folder


Values folder its for you to set color, string (text), dimes (dimension), and style (usually its for theme android apps)

https://dedyyuristiawan.blogspot.co.id
Values Folder 


The important file its AndroidManifest.xml its for manage your activity, theme, and name of android apps. see and understand it. There another file that important in android project is a build.gradle file. This file if want to use library in folder or web, so android studio can automatically add library if you put link in dependency code.

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
}

https://dedyyuristiawan.blogspot.co.id
Build.Gradle File


if you want to use library android just put bellow  compile 'com.android.support:appcompat-v7:23.4.0' and click sync, android will automatically add library in you android project.

So if you understand with all of that we can run android project or you can write comment in bellow. Before you want run android project android studio you must create android virtual device with this step :

Click button run app (green triangle in top) > 
Create emulator > choose phone that you want > next > 
Choose os android (i suppose you to choose os with ABI x86, because it can help emulator run fast) > next > 
Write your avd name > finish > wait > 
Choose adv that you created > click ok and emulator android will be show.

Yoyoy its post about create first android apps, if you still have confuse about my post you can write comment bellow and i hope can help you to first develop android apps. And the last you can download this app in my github Thanks.

Github Source Code and my All Picture Post.



Share:

Sunday 19 June 2016

Dagging Android Application




Hello world. Finally today i want to introduce to you, my first portfolio its Dagging App (Dagging Android Application). So what is't ? Dagging App is a Android Application that can help you choose the best quality of cow meat. Basically its from my thesis when i was study in University and the title is 'Identification Of Beef Quality Based On Android Using Feature Extraction Of Colour And Knn Classification', I create this application because in my country (Indonesia) has problem with 'glonggongan' meat. 'Glonggongan' meat is a something like foul meat (You can search in Google).  Do you want to consume foul meat? i think no, yes you can use this app for you life its free. But unfortunately this app not available in google play, because i don't have credit card to put my app in google play, but don't worry, someday i will put on the google play. You can download in my drive.


https://dedyyuristiawan.blogspot.com https://dedyyuristiawan.blogspot.com https://dedyyuristiawan.blogspot.com


So here we are Dagging Android Application that app can help you choose fresh meat, the best meat, no more foul meat again, no more think about consume meat with level of accuracy of 75%, best user interface, simple that can use it in the first time meet. 'just eat' that's it.

Share:


<br>


Advice for contacting me at dedyy54@gmail.com