19
Rapid Android Development for Hackathon Ade Rifaldi Android Developer | Radya Labs

Rapid Android Development for Hackathon

Embed Size (px)

Citation preview

Page 1: Rapid Android Development for Hackathon

Rapid Android Developmentfor Hackathon

Ade RifaldiAndroid Developer | Radya Labs

Page 2: Rapid Android Development for Hackathon

Table of Content• About Me

• Tips & Tricks Hackathon

• ButterKnife

• Integration Azure Mobile Service

• Sample Project

• Q & A

Page 3: Rapid Android Development for Hackathon

Ade Rifaldi• 2008 : IT UIN Jakarta (Graduated 2013)

• 2014 : Android Developer Radya Labs

• 2016 : Facilitator Android Kejar Batch 1

Intermediate Class

Contacts:• Email : [email protected]

• WA : 085719004268

• Linkedin : [email protected]

Page 4: Rapid Android Development for Hackathon

Hackathon Experience

•2015 : Educode >> Samosir

•2016 : IWIC 11 >> Tarakan

•2016 : BCA Finhack >> EasySell

•2016 : Facebook >> Twinnies Menu

•2016 : TNI AD >> Lagan

Page 5: Rapid Android Development for Hackathon
Page 6: Rapid Android Development for Hackathon

Tips Hackathon: Idea•OOT is Bad IdeaEvery hackathon has a topic. Don’t develop app that out of the topic.

•Problem SolutionYour app must solve the problem. Less technology but solve the problem better than less solution but lot of technology.

•Wow FactorPrepare cool stuff that can make jury excited.

•Focus to Demo: Hard code? Why not?Don’t develop full version of the app. You not have much time for present it to the judgment session. Even, you only have 1 minute to demo. Focus to the core.

Page 7: Rapid Android Development for Hackathon

Get Things Prepared

•The Team: Coder & PresenterHackathon wasn’t just about coding.

•Learn Hackathon Environment, First: API

•Create To Do List

•Never Forget Judgment PointsProblem Solution, Originality, User Friendly, API Implementation, Readiness, etc.

Page 8: Rapid Android Development for Hackathon

Steal Start is Fine

•Setup Group Chat

•Setup Project: User Interface, Library

•Setup Git

•Setup Cloud Service / Web Service

Page 9: Rapid Android Development for Hackathon

During Hackathon

•Take Frequent BreaksDon't let you sick after hackathon

•Have Fun!

•Presentation: Less Text, Lot Screen Shoot, Make a Story, Use Usual Words.

Page 10: Rapid Android Development for Hackathon

Tricks Hackathon• ButterKnife

• Retrofit

• Cloud Service :

Azure Mobile Service

Firebase

AWS

• Json2Java : http://www.jsonschema2pojo.org/

• Icons : http://www.flaticon.com/

Page 11: Rapid Android Development for Hackathon

Without ButterKnife• Declare

• Initialize

• OnClick

private Button btn_login;

btn_login = (Button) findViewById(R.id.btn_login);

btn_login.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View v) {

//execute login

}

Page 12: Rapid Android Development for Hackathon

ButterKnife• Add Pulgin apt to gradle (Project)

• Apply Plugin apt to gradle (Module)

• Add to gradle (Module)

classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

compile 'com.jakewharton:butterknife:8.3.0'

apt 'com.jakewharton:butterknife-compiler:8.3.0'

apply plugin: 'android-apt'

Page 13: Rapid Android Development for Hackathon

ButterKnife for Bind View• Declare

• Binding

@BindView(R.id.img) ImageView img;

@BindView(R.id.title) TextView title;

setContentView(R.layout.activity_news_detail);

ButterKnife.bind(this);

Page 14: Rapid Android Development for Hackathon

ButterKnife for OnClick@OnClick(R.id.share)

protected void share(){

String content;

if (isi.length() > 114){

content = isi.substring(0, 114) + " ...";

}else {

content = isi;

}

shareContent(judul, content);

}

Page 15: Rapid Android Development for Hackathon

Integrate Azure Mobile Service with Android• Add Azure Mobile Service SDK

• Add Gson Library

compile 'com.microsoft.azure:azure-mobile-services-android-sdk:2.0.2+'

compile 'com.google.code.gson:gson:2.7'

Page 16: Rapid Android Development for Hackathon

Create Model from Azure Table

public class TPromo implements Serializable {

@com.google.gson.annotations.SerializedName("id")

private String id;

@com.google.gson.annotations.SerializedName("image")

private String image;

@com.google.gson.annotations.SerializedName("title")

private String title;

@com.google.gson.annotations.SerializedName("description")

private String description;

Page 17: Rapid Android Development for Hackathon

Setup Azure Servicepublic void setupAzureService() {

try {

// Create the Mobile Service Client instance, using the provided

// Mobile Service URL and key

mobileServiceClient = new MobileServiceClient(

GlobalVariable.AZURE_SERVICE_URL,

GlobalVariable.AZURE_SERVICE_KEY,

getActivity()).withFilter(new ProgressFilter());

// Get the Mobile Service Table instance to use

mobileServiceTable = mobileServiceClient.getTable(TPromo.class);

} catch (MalformedURLException e) {

AppUtility.logD("TAG", "There was an error creating " +

"the Mobile Service. Verify the URL");

}

}

Page 18: Rapid Android Development for Hackathon

Load Dataprivate void loadPromos(){

new AsyncTask<Void, Void, Void>() {

@Override

protected Void doInBackground(Void... params) {

try {

final MobileServiceList<TPromo> result = mobileServiceTable.execute().get();

getActivity().runOnUiThread(new Runnable() {

@Override

public void run() {

tPromos = new ArrayList<>();

tPromos.clear();

for(TPromo item : result){

tPromos.add(item);

}

adapter.getData().addAll(tPromos);

adapter.notifyItemInserted(adapter.getData().size() - 1);

list.setLayoutManager(linearLayoutManager);

list.setAdapter(adapter);

}

});

} catch (Exception exception) {

AppUtility.logD("MainActivity", "get comment Error");

}

return null;

}

}.execute();

}

Page 19: Rapid Android Development for Hackathon

Azure Mobile ServiceClient Library Documentation

https://github.com/aderifaldi/SampleAzureMobileService

Sample Project

https://docs.microsoft.com/en-us/azure/app-service-mobile/app-service-mobile-android-how-to-use-client-library