free counters
Diberdayakan oleh Blogger.
Tampilkan postingan dengan label Android. Tampilkan semua postingan
Tampilkan postingan dengan label Android. Tampilkan semua postingan

Rabu, 27 Juli 2016

Menampilkan string dengan cetak tebal menggunakan strings.xml dan pre-formatted string

by Unknown  |  in Android Tips at  Rabu, Juli 27, 2016
Untuk menampilkan teks nominal yang ditebalkan (bold) dan dalam bentuk nilai mata uang dapat dilakukan dengan menggunakan formatter dan string di strings.xml file. Misalkan kita memiliki nilai nominal 10000 dalam tipe long:

long nominal = 10000;

Untuk memformatnya ke dalam bentuk nilai mata uang, kita menggunakan:

DecimalFormat formatter = new DecimalFormat("###,###,###.##");

Kemudian jika ingin ditampilkan menggunakan pre-formatted string seperti
Your Remaining balance: Rp 10.000,
 kita terlebih dahulu harus menyiapkan file strings.xml seperti ini:

<resources>
  <string name="remaining_balance">Your Remaining balance: &lt;b>Rp. %s&lt;/b></string>
</resources>

Setelah itu kita baca sebagai html, lalu set ke TextView atau EditText yang kita mau. Seperti ini:

String balance = getString(R.string.remaining_balance, formatter.format(nilaiNominal));
CharSequence styledText = Html.fromHtml(balance);
textView.setText(styledText);

Maka keseluruhan kodenya akan menjadi seperti ini:

long nominal = 10000; // Nilai yang mau ditampilkan
DecimalFormat formatter = new DecimalFormat("###,###,###.##"); // Format ke uang
String balance = getString(R.string.remaining_balance, formatter.format(nominal)); // sesuaikan dengan pre-formatted string.
CharSequence styledText = Html.fromHtml(balance); // baca sebagai html
textView.setText(styledText); // terapkan ke TextView atau EditText


Salam Slacker.

Sabtu, 05 Maret 2016

Mengubah warna tanda panah back di theme material Android

by Unknown  |  in Android Tips at  Sabtu, Maret 05, 2016
Saya tadi pagi kesulitan untuk membuat warna tanda panah back di action bar Android menjadi berwarna putih. Keseluruhan design aplikasi yang saya buat memakai theme dark dengan tulisan judul action bar berwarna putih.

Awalnya saya mencoba dengan menambahkan kode di style.xml seperti ini:
 <item name="colorControlNormal">@color/white</item>   
namun, tanda panahnya sama sekali tidak berubah, tetap hitam seperti Gambar 1 di bawah ini:

Gambar 1, dengan kode xml di style

Solusinya ternyata adalah dengan menggunakan kode di bawah ini:
1:  // Ini untuk support library 23.2.0. Untuk support library di bawahnya,  
2:  // gunakan R.drawable.abc_ic_ab_back_mtrl_am_alpha  
3:  final Drawable upArrow = ContextCompat.getDrawable(this, R.drawable.abc_ic_ab_back_material);  
4:  upArrow.setColorFilter(ContextCompat.getColor(this, R.color.white), PorterDuff.Mode.SRC_ATOP);  
5:  getSupportActionBar().setHomeAsUpIndicator(upArrow);  
Hasilnya setelah diterapkan dapat dilihat pada Gambar 2 di bawah ini:

Gambar 2, dengan kode Java

Semoga dapat membantu :).



Referensi:
1.How to change color of the back arrow in the new material theme?
2.How to set Toolbar text and back arrow color

Senin, 29 Februari 2016

Link yang dapat diklik dari String untuk TextView Android

by Unknown  |  in pemrograman visual at  Senin, Februari 29, 2016


Contoh project dari artikel ini dapat di download Di sini.

Ada beberapa cara tersembunyi yang dapat kita pakai untuk membuat link url dalam sebuah string bekerja di AppCompatTextView pada Android.

Saya menemukan bahwa di custom view (sejujurnya, saya masih mencoba dengan Material Dialogs), sebuah string dengan url hanya bekerja jika kita menggunakan setMovementMethod untuk TextView


Pada Custom View

Jika kita ingin sebuah string yang mengandung url dan kode html di custom view seperti ini:
 Created by <b>Joielechong</b> (<a href="http://www.rilixtech.com">rilixtech.com</a>)  
Dengan TextView di layout seperti file xml di bawah ini:
1:  <?xml version="1.0" encoding="utf-8"?>  
2:  <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
3:    android:id="@+id/sample_layout"  
4:    android:layout_width="match_parent"  
5:    android:layout_height="match_parent"  
6:    >  
7:    
8:   <android.support.v7.widget.AppCompatTextView  
9:     android:id="@+id/sample_layout_title"  
10:     android:layout_width="wrap_content"  
11:     android:layout_height="wrap_content"  
12:     android:textSize="18sp"  
13:     />  
14:  </RelativeLayout>  
Kita tidak akan bisa membuatnya bekerja jika menggunakan attribut android:autoLink="all" atau android:linksClickable="true". Jadi, kode di bawah ini Tidak Akan Bekerja:
1:  <?xml version="1.0" encoding="utf-8"?>  
2:  <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
3:    android:id="@+id/sample_layout"  
4:    android:layout_width="match_parent"  
5:    android:layout_height="match_parent"  
6:    >  
7:    
8:   <android.support.v7.widget.AppCompatTextView  
9:     android:id="@+id/sample_layout_title"  
10:     android:layout_width="wrap_content"  
11:     android:layout_height="wrap_content"  
12:     android:text="@string/test_string_1"  
13:     android:textSize="18sp"  
14:     android:autoLink="all"  
15:     android:linksClickable="true"  
16:     />  
17:    
18:  </RelativeLayout>  
Untuk membuatnya bekerja, kita harus menambahkan baris berikut pada kelas:
 textView.setMovementMethod(LinkMovementMethod.getInstance());  
Jangan lupa untuk menghapus attribut android:autoLink="all" di layout xml karena attribut ini akan menyebabkan kode di atas tidak berfungsi sama sekali.


Pada Normal View

Jika kita menggunakan setMovementMethod untuk TextView tanpa menggunakan attribut android:autoLink="all" di layout, link url akan bekerja. Link url juga akan bekerja jika kita hanya menggunakan android:autolink="all". Tetapi jika kita hanya menggunakan attribut android:linksClickable="true" maka link url tidak akan bekerja sama sekali.

Download project artikel ini  Di sini.

Referensi:
How do I make links in a TextView clickable?
I want text view as a clickable link
Android: textview hyperlink
Make a hyperlink textview in android
How to make normal links in TextView clickable?

Clickable Link In String for TextView Android

by Unknown  |  in pemrograman visual at  Senin, Februari 29, 2016


You can download the working example for this tutorial in Here.

There are some hidden quirk that could be use to make an url link in string working in AppCompatTextView in android.

I found that in custom view (honestly, I just trying it with Material Dialogs), a string with an url only work if we use setMovementMethod for TextView


In Custom View

If we want a string containing an url and html code in custom view like this:
 Created by <b>Joielechong</b> (<a href="http://www.rilixtech.com">rilixtech.com</a>)  
For a TextView in a layout like the following xml file:
1:  <?xml version="1.0" encoding="utf-8"?>  
2:  <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
3:    android:id="@+id/sample_layout"  
4:    android:layout_width="match_parent"  
5:    android:layout_height="match_parent"  
6:    >  
7:    
8:   <android.support.v7.widget.AppCompatTextView  
9:     android:id="@+id/sample_layout_title"  
10:     android:layout_width="wrap_content"  
11:     android:layout_height="wrap_content"  
12:     android:textSize="18sp"  
13:     />  
14:  </RelativeLayout>  
We can't make it work by using either android:autoLink="all" or android:linksClickable="true". So the following code Won't work:
1:  <?xml version="1.0" encoding="utf-8"?>  
2:  <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
3:    android:id="@+id/sample_layout"  
4:    android:layout_width="match_parent"  
5:    android:layout_height="match_parent"  
6:    >  
7:    
8:   <android.support.v7.widget.AppCompatTextView  
9:     android:id="@+id/sample_layout_title"  
10:     android:layout_width="wrap_content"  
11:     android:layout_height="wrap_content"  
12:     android:text="@string/test_string_1"  
13:     android:textSize="18sp"  
14:     android:autoLink="all"  
15:     android:linksClickable="true"  
16:     />  
17:    
18:  </RelativeLayout>  
To make it work, we must add a line of code in our working class below:
 textView.setMovementMethod(LinkMovementMethod.getInstance());  
Remember to remove android:autoLink="all" in your layout xml because it render the above code useless.


In Normal View

If we use setMovementMethod for TextView and without android:autoLink="all" attribute in layout, url link will be enabled. Using only android:autolink="all" will also working. By using only android:linksClickable="true" url link will not working at all.

Download the working project Here.


Reference:
How do I make links in a TextView clickable?
I want text view as a clickable link
Android: textview hyperlink
Make a hyperlink textview in android
How to make normal links in TextView clickable?

Jumat, 26 Februari 2016

Error: You need to use a Theme.AppCompat theme (or descendant) with the design library

by Unknown  |  in Android Tips at  Jumat, Februari 26, 2016
If you in the middle of developing android application with Android Studio when the day before it's working fine, but in the next editing you encountered an error like this:

Binary XML file line #2: Error inflating class android.support.design.widget.CoordinatorLayoutat android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)...
Caused by: java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) with the design library.

Please go and check your module library and replace the style of it with Theme.AppCompat theme (or descendant). It's not your fault, it's because you're using some library that too old or not using the same theme with your app code.

Don't waste your time by pulling your hair..;).


Happy Programming.

Rabu, 27 Januari 2016

Custom view With Multiple Value Using Flags attributes on Android

by Unknown  |  in pemrograman at  Rabu, Januari 27, 2016
Most standard Android UI views give us very general usage than can be used in many tasks and many situations. But in some apps we need to be able to customize those standard views to suit our own needs.

We can customizing standard view to create our custom views by extending View or an existing subclass. There are generally 3 three steps to create our custom view:
   1. Extend View by subclassing
   2. Define custom attributes
   3. Add logic based on the attributes

In this article, we will extending TextView to create our custom view. The Custom view, which we called CustomTextView, will be a simple TextView with prefix and suffix. The prefix can be bolded, italized, large, or the combination of those three attributes. We will achieve like picture below:



To have a combination of attribute value, we must use attribute with flags. More on this later.



Extend View by Subclassing

Because we extending TextView we must create our own class, CustomTextView, like this:
  public class CustomTextView extends TextView {  
   public CustomTextview(Context context, AttributeSet attrs) {  
    super(context, attrs);  
   }  
  }  
TextView has many different constructors, but for most purpose it's sufficient to implement just one like the code above. Also for the shake of simplicity of the article, I don't show the rest of the code.

Define Custom Attributes

Our custom view will have attribute to set prefix, suffix, and the text style of suffix. There are 3 text style for prefix: Bold, Italic, and Large. So we need to create three attributes for them like this:
1:  <resources>  
2:    <declare-styleable name="CustomTextView">  
3:     <attr format="string" name="ct_prefix">  
4:     <attr format="string" name="ct_suffix">  
5:     <attr name="ct_prefix_style">  
6:       <flag name="Bold" value="1">  
7:       <flag name="Italic" value="2">  
8:       <flag name="Large" value="4">  
9:     </flag></flag></flag></attr>  
10:    </attr></attr></declare-styleable>  
11:   </resources>  
We use flags because it is the only attribute types that allow us to combine multiple value. It's like when we use android:textStyle, where we can define text as both bold and italic value with android:textStyle="bold|italic". Read more at Android: Custom XML attributes and views .

Maybe you a little confused by the flags values. We use values of 1, 2, and 4 for Bold, Italic, and Large names respectively because it is easier working with when OR-ing them. Those values; 1, 2, and 4 are decimal values from binary values. Please look at the table below:

Decimal Binary
1 0001
2 0010
4 0100

So when OR-ing them like Bold|Italic (Bold = 1, Italic = 2), we will get the value of 3 which is 0011 in decimal. The effect is, we can't lose our flags value!


Add logic Based On The Attributes

To access the attributes from code, we must get the attributes by using obtainStyledAttributes() method like the following code:
 final TypedArray attributes = context.obtainStyledAttributes(attrs,R.styleable.CustomTextView, defStyleAttr, defStyleRes);  

Then we can get each attribute by using the attributes object, like this:
 final CharSequence prefix = attributes.getText(R.styleable.CustomTextView_ct_prefix);  
 final CharSequence suffix = attributes.getText(R.styleable.CustomTextView_ct_suffix);  
 prefixStyle = attributes.getInteger(R.styleable.CustomTextView_ct_prefix_style, 0);  
Remember to give back resource to system by recycle th attributes:
 attributes.recycle();  

After we have all the value from attributes, we do the work based on the value. Here we will work with ct_prefix_style because it's more difficult than other.

Because we working with the chance of combined value from ct_prefix_style flags, we handle it by AND-ing it to get the value.

For everyone who don't remember what is AND-ing, I try to explain it with AND table below, where x is AND-ed with y:

X Y Result
0 0 0
0 1 0
1 0 0
1 1 1

every value AND-ed with 0 will be 0, and only value 1 AND-end with 1 will be 1.

Back to main story. We AND-ing the ct_prefix_style attribute value with each flag value like below:
  if((prefixStyle & PrefixStyle.BOLD) == PrefixStyle.BOLD) {  
   spannableString.setSpan(new TextAppearanceSpan(getContext(), R.style.Bold), 0, prefix.length(), 0);  
  }  
  if((prefixStyle & PrefixStyle.ITALIC) == PrefixStyle.ITALIC) {  
   spannableString.setSpan(new TextAppearanceSpan(getContext(), R.style.Italic), 0, prefix.length(), 0);  
  }  
  if((prefixStyle & PrefixStyle.LARGE) == PrefixStyle.LARGE) {  
   spannableString.setSpan(new TextAppearanceSpan(getContext(), R.style.Large), 0, prefix.length(), 0);  
  }  

where the PrefixStyle variables are from PrefixStyle class:
1:   public class PrefixStyle {  
2:    public static final int BOLD = 1;  
3:    public static final int ITALIC = 2;  
4:    public static final int LARGE = 4;  
5:   }  
Here the prefixStyle is AND-ed to check if flag attribute is used or not.

Then we can apply the style to the text.

To use our CustomTextView, we just add the xml code like below:
1:  <io.github.joielechong.CustomTextView  
2:    android:layout_centerHorizontal="true"  
3:    android:text="10000"  
4:    android:layout_width="wrap_content"  
5:    android:layout_height="wrap_content"  
6:    custom:ct_prefix="$"  
7:    android:textSize="24sp"  
8:    custom:ct_suffix="-"  
9:    custom:ct_prefix_style="Bold|Italic"  
10:  />  

Don't forget to add the following code at your root layout:
 xmlns:custom="http://schemas.android.com/apk/res-auto"  


For the complete library and example source code, you can get at CustomTextView in my github.

Every critiques, suggestions, and correction are really appreciated.

Jumat, 08 Januari 2016

BigDecimalUtils, A Small BigDecimal Comparison and Calculation Utility for Java and Android.

by Unknown  |  in Library at  Jumat, Januari 08, 2016
I've release a small library for comparison and calculation with BigDecimal, BigDecimalUtils. Here the readme:


A Small BigDecimal Comparison and Calculation Utility for Java and Android.
Much of the comparison code (if not all) are heavily taken from Representing money.

Why

We need to work with BigDecimal when working with monetary value because double or float are not recommended since they always carry small rounding differences.
So we need to make comparison and calculation of BigDecimal.
We can use compareTo method for comparison, but it too error prone and lacks readability.
Furthermore, doing calculation with BigDecimal is so unnatural.

How It Work

  • Import library to your code:
    import static com.github.joielechong.currencytextcounter.util.BigDecimalUtils.*;
  • Doing comparison:
    if(is(income).lt(amount)) {
      // ....
    }else {
      // ...
    }
  • Do calculation:
    remain = calculate(income).min(expense);

Other methods currently in this library

      is(bigdecimal).eq(four);    // Equal
      is(bigdecimal).gt(two);     // Greater than
      is(bigdecimal).gteq(one);   // Greater than equal
      is(bigdecimal).lt(two);     // Less than
      is(bigdecimal).lteq(two);   // Less than equal

      calculate(bigdecimal).min(bigdecimal)   // subtraction
      calculate(bigdecimal).plus(bigdecimal)  // addition
      calculate(bigdecimal).div(bigdecimal)   // division
Currently comparison support only String and BigDecimal:
      is(bigdecimal).eq(bigdecimal);    // BigDecimal and BigDecimal
      is(bigdecimal).eq("1000");        // BigDecimal and String
      is("1000").lt("2000");            // String and String
      is("1000").lt(bigdecimal);        // String and BigDecimal
Calculation support some of int, long, float, and BigDecimal (please check the library):
      calculate(bigdecimal).min("500")  // String and String
      calculate("1000").min("500")      // String and String
      calculate(100).min("500")         // int and String
      calculate(1l).min("500")          // long and String

Sabtu, 26 Desember 2015

Font Cache untuk Custom TextView Android

by Unknown  |  in Java at  Sabtu, Desember 26, 2015
Saya saat ini sedang mengembangkan Custom View untuk pengembangan aplikasi Android. Custom view ini merupakan TextView yang berfungsi untuk menampilkan nilai mata uang. Untuk menambahkan nilai estetika dari Custom View ini, saya tambahkan fitur untuk menggunakan font lain.

Untuk efesiensi, saya menggunakan kelas FontCache untuk cache custom font.


 public class FontCache {  
   
 private static HashMap<String, Typeface> fontCache = new HashMap<>();  
   
 public static Typeface getTypeface(String fontname, Context context) {  
   Typeface typeface = fontCache.get(fontname);  
   
   if (typeface == null) {  
     try {  
       typeface = Typeface.createFromAsset(context.getAssets(), fontname);  
     } catch (Exception e) {  
       return null;  
     }  
   
     fontCache.put(fontname, typeface);  
   }  
   
   return typeface;  
 }  
kelas FontCache ini berasal dari britzl di stackoverflow dan Custom Fonts on Android — Extending TextView.


Referensi:
Custom Fonts on Android — Quick & Dirty

Senin, 09 November 2015

Signing Android apk without putting keystore info in build.gradle

by Unknown  |  in Slackware at  Senin, November 09, 2015

When releasing apk via gradle, we have to sign it with our keystore and its password. The easiest way is to include our keystore link and password directly in build.gradle:
 android {  
   ...  
   signingConfigs {  
     release {  
       storeFile file("my.keystore")  
       storePassword "store_password"  
       keyAlias "my_key_alias"  
       keyPassword "key_password"  
     }  
   }  
   buildTypes {  
     release {  
       signingConfig signingConfigs.release        
     }  
   }  
 }  
It's simple but giving us a pretty bad risk. If we working with versioning system like git, we will get a risk of exposing our keystore and password.


Separating keystore and Password From build.gradle

Some articles like Signing Open Source Android Apps Without Disclosing Passwords and Use signing.properties file which controls which keystore to use to sign the APK with gradle give us a way by making a properties file which build.gradle file will refer, then we add it to git ignore list. But what happens when we forget to add the properties file to ignore list? We will disclose our password to the world. The problems still persist.

Instead making properties file in the same directory within our project, we should make it outside. We make it outside by using gradle.properties file.

Here the steps (all code can be download from my gist):

1. Edit or create gradle.properties on your root project and add the following code, remember to edit the path with your own:
 AndroidProject.signing=/your/path/androidproject.properties  

2. Create androidproject.properties in /your/path/ and add the following code to it, don't forget to change /your/path/to/android.keystore to your keystore path:
 STORE_FILE=/your/path/to/android.keystore  
 STORE_PASSWORD=yourstorepassword  
 KEY_ALIAS=yourkeyalias  
 KEY_PASSWORD=yourkeypassword  

3. In your app module build.gradle (not your project root build.gradle) add the following code if not exist or adjust to it:
 signingConfigs {  
     release  
   }  
   buildTypes {  
     debug {  
       debuggable true  
     }  
     release {  
       minifyEnabled true  
       proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'  
       signingConfig signingConfigs.release  
     }  
   }  

4. Add the following code below the code in step 3:
 if (project.hasProperty("AndroidProject.signing")  
     && new File(project.property("AndroidProject.signing").toString()).exists()) {  
     def Properties props = new Properties()  
     def propFile = new File(project.property("AndroidProject.signing").toString())  
     if(propFile.canRead()) {  
      props.load(new FileInputStream(propFile))  
      if (props!=null && props.containsKey('STORE_FILE') && props.containsKey('STORE_PASSWORD') &&  
         props.containsKey('KEY_ALIAS') && props.containsKey('KEY_PASSWORD')) {  
         android.signingConfigs.release.storeFile = file(props['STORE_FILE'])  
         android.signingConfigs.release.storePassword = props['STORE_PASSWORD']  
         android.signingConfigs.release.keyAlias = props['KEY_ALIAS']  
         android.signingConfigs.release.keyPassword = props['KEY_PASSWORD']  
      } else {  
         println 'androidproject.properties found but some entries are missing'  
         android.buildTypes.release.signingConfig = null  
      }  
     } else {  
            println 'androidproject.properties file not found'  
          android.buildTypes.release.signingConfig = null  
     }  
   }  
This code will search for AndroidProject.signing property in gradle.properties from step 1. If the property found, it will translate property value as file path which pointing to androidproject.properties that we create in step 2. Then all the property value from it will be used as signing configuration for our build.gradle.

Now we don't need to worry again of risk of exposing our keystore password.

The above step have been test on Android Studio 1.4.1 in Slackware64 current with these settings in build.gradle:
- 'com.android.tools.build:gradle:1.2.3'
- buildToolsVersion "22.0.1"


Note: 
Article is heavily being influenced with Handling signing configs with Gradle article.

References:
1. Handling signing configs with Gradle
2. Use signing.properties file which controls which keystore to use to sign the APK with gradle.
3. http://stackoverflow.com/questions/20562189/sign-apk-without-putting-keystore-info-in-build-gradle
4. Signing Open Source Android Apps Without Disclosing Passwords
5. Where to put the gradle.properties file
6. Gradle Doc, Configuring the build environment via gradle.properties

Sabtu, 07 November 2015

Fix Error when update Android Studio to Android Studio 1.4

by Unknown  |  in Slackware at  Sabtu, November 07, 2015
After I'm trying to upgrade my old Android Studio 1.3 to 1.4 with slackware build generated package from SlackBuilds.org, there is an error "Your Android Studio installation is corrupt and will not work properly..." like picture below (Picture 1.1):


First I think it complaining about conflicting plugins where old installation files reside, so maybe after I reinstall it will be fixed. But It always show the same error even though I've reinstalled Android Studio.

Then I try to remove my old Android Studio installation folders in my home directory, but instead deleting, I choose to rename all of them:
  1. ~/.AndroidStudio
  2. ~/.android
  3. ~/.AndroidStudio1.3
But the error still showing...Arrrggh

Still with plenty of courage in my heart, I try with another route. Though I'm suspecting that the package I generated with slackbuild file is broken because the slackbuild file is for Android Studio 1.1, I uninstall the Android Studio then remove the remaining directory where Android Studio installed, which is in /usr/share/android-studio/.

Voila!!!, now Android Studio working normal again.. :D :D :D


Note: I'm working with Slackware64 Current (build Agustus 2015)

Sabtu, 10 Oktober 2015

Membuat Game Online Android

by Unknown  |  in pemrograman at  Sabtu, Oktober 10, 2015

Ternyata banyak hal yang perlu dipersiapkan untuk mengembangkan Game online untuk Android. Baik dari segi finansial, kejiwaan, serta teknisnya. Secara finansial, kalau gak punya uang yang gak bisa makan. Jadi kalau gak makan kan gak mungkin bisa membuat game, ya kan? hahaha. Secara kejiwaan, kalau jiwa gak kuat bakalan cepat stress mengerjakannya, dan bisa jadi gagal membuat gamenya. Jadi harus dipastikan seorang pembuat game harus tidak mengalami gangguan kejiwaan.

Karena secara finansial saya masih bisa makan dan secara kejiwaan saya masih normal, maka hal yang perlu dikaji sekarang adalah hal teknisnya.

Dalam mengembangkan game online untuk Android adalah beberapa hal yang perlu dikuasai:

1. Jenis Game
Kita harus mengerti jenis game apa yang kita kembangkan, apakah game turn base, atau game MMORPG yang melibatkan banyak pemain sekaligus, atau game First-Person Shooter yang membutuhkan tingkat akurasi game.

2. Server Game
Bagi masing-masing game dibutuhkan jenis server yang berbeda. Untuk first person shooter, server membutuhkan tingkat akurasi yang tinggi. Untuk game MMORPG, server membutuhkan kemampuan untuk melayani banyak pengguna sekaligus, yang mungkin sampai 100.000 pengguna secara bersamaan seperti Game Clash Of Clans. Beberapa open source game server ini patut dicoba: gamemachine, KBEngine, dan Nugetta.

3. Game Engine
Dibutuhkan Game Engine untuk memudahkan kita membuat game. Tentu saja kita bisa mengembangkan sendiri game dari dasar, tetapi hal tersebut akan menghabiskan waktu. Ini beberapa Game Engine yang dapat dipakai: LibGDX, Unity3D, OGRE, Cocos2d-x.

Nah, ketiga hal inilah yang perlu kita kuasai sebelum mengembangkan game. Memang selain ketiga hal tersebut adalah hal terpenting yang sengaja saya tidak cantumkan, yakni Ide. Mengapa saya tidak cantumkan? Karena tidak mungkin mengembangkan game tanpa memiliki ide akan game apa yang ingin dihasilkan bukan?.

Selamat membuat game..:) ;)




sumber gambar: https://en.wikipedia.org/wiki/Game_engine

Jumat, 19 Juni 2015

QuickestMath Pro, Game Matematika yang cepat, mudah, dan membuat emosi

by Unknown  |  in Game at  Jumat, Juni 19, 2015

Quickest Math akan membuatmu kesal pada perhitungan matematika sederhana.

Apakah kamu jenius di matematika?
Tantang dirimu dengan level tertinggi sebagai "SuperMan".

Bagaimana memainkannya: 

  1. Pilih jawaban yang benar dalam waktu terbatas! 
  2. Pilih level penguasaan matematikamu dan tantang teman-temanmu! 
  3. Dapatkan skor tertinggi! 
  4. Bagikan skor tertinggimu!

Install game ini dari Play Store di link Quickest Math Pro.

Programmer Desainer

by Unknown  |  in Graphic at  Jumat, Juni 19, 2015
Kali ini saya mencoba kemampuan untuk membuat game sederhana di Android dengan mendesain sendiri sebagian besar karakter gamenya. Game sederhana ini berupa game yang bersifat Tower Defense.

Ini contoh hasil pembelajaran saya selama satu hari:



Kata teman saya karakter yang saya buat ini keren.. Hmm, jadi saya pikir saya ternyata punya bakat desain...wkwkwkw...:D

Intinya, selalu berani mencoba mengeksplorasi hal-hal yang tidak pernah kamu lakukan. Seperti saya yang gak pernah mendesain karakter game sebelumnya. Hanya dalam satu hari bisa menghasilkan karakter yang katanya "Keren"... 8:)


Note: Karakter ini sepenuhnya dibuat memakai Inkscape di Linux Slackware64 Current.

Senin, 15 Juni 2015

Akses USB Debugging di Slackware Untuk Android Studio

by Unknown  |  in Slackware at  Senin, Juni 15, 2015
Agar dapat mengakses fitur USB Debugging dari perangkat Android di Slackware dapat dilakukan dengan membuat file 51-android.rules di /etc/udev/rules.d/. Untuk perangkat Android Advan T4i, dapat diakses dengan menambahkan baris berikut di file 51-android.rules:
 SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4e22", MODE="0664", GROUP="plugdev", SYMLINK+="android_adb"  
Kemudian restart komputer. Jangan lupa untuk menambahkan nama user Anda sebagai group plugdev di file /etc/group. Jika Anda ingin menambahkan akses USB Debugging untuk perangkat lain, cukup dengan menambahkan baris di atas, lalu ubah idVendor dan idProduct dari perangkat. idVendor dan idProduct bisa didapatkan dengan perintah lsusb sebagai root:
 # lsusb  
perintah ini akan menghasilkan keluaran seperti gambar 1.1:

Pada tampilan ini kita temukan baris "Bus 001 Device 012: ID 18d1:4e22 Google Inc. Nexus S (debug)" yang merupakan perangkat Android yang saya miliki. isikan nilai 18d1 ke idVendor dan 4e22 ke idProduct. Silahkan sesuaikan dengan perangkat yang Anda miliki.

Untuk daftar file 51-android.rules yang lebih lengkap, silahkan akses android-udev-rules.

Catatan Penting: Mohon diingat bahwa saat saya mencoba baris file di situs android-udev-rules pada slackware box, ini tidak bekerja sama sekali. Di Slackware ATTR tidak bekerja sehingga harus digantikan dengan ATTRS.

Minggu, 12 April 2015

Starting learning Java Canvas

by Unknown  |  in Java at  Minggu, April 12, 2015
Now I'm starting learning Java Canvas for my next Android project which using custom graphics.
Somehow I feel like I can't make it, but my inner voice keep telling me to keep learning and doing it. Because I respect my inner voice, I'll do the best on learning it. Well, nothing is impossible if we believe..:)

For everyone who trying to learn Canvas in java, these resources will help you:
  1. Introduction to graphics programming in Java (PDF)
  2. Canvas (Wiki) 
  3. Android Programming Tutorial (coreservlets.com)
  4. Java Programming Tutorial Custom Graphics

Well, I hope I'll finished devouring these resources on 3 days..


note: In case of these resources dead, I have backup it all in my Google Drive.

Sabtu, 06 Desember 2014

Kidung Jemaat, Nyanyikanlah Kidung Baru, dan Pelengkap Kidung Jemaat Android Application

by Unknown  |  in Android at  Sabtu, Desember 06, 2014
Kidung Jemaat, the new Android application finally release yesterday...:D

https://play.google.com/store/apps/details?id=com.rilixtech.kidungjemaat
Kidung Jemaat Androi App Icon

Here is the details:

Kidung Jemaat, Nyanyikanlah Kidung Baru, dan Pelengkap Kidung Jemaat in one application with midi song.
Kidung Jemaat compiled and is now published by the Yayasan Musik Gereja in Indonesia.
Nyanyikanlah Kidung Baru is issued by the Badan Pengerja Majelis Sinode (BPMS) Gereja Kristen Indonesia.
Pelengkap Kidung Jemaat (abbreviated PKI) is a book of hymns (hymns) are made to complement the Kidung Jemaat.
Features:
1. Bookmark songs.
2. Song categorized based on its type.
3. Personalize the application with themes.
4. Simple and beautiful design.
5. Midi song already included so we don't need to download it anymore when playing the song.
6. Can work on portrait or landscape mode.
7. Free from Advertising.

Rabu, 26 November 2014

Mengatasi Host 'xxx.xx.xxx.xxx' is not allowed to connect to this MySQL server

by Unknown  |  in Sistem Informasi at  Rabu, November 26, 2014
Untuk mengatasi Host 'xxx.xx.xxx.xxx' is not allowed to connect to this MySQL server yang terjadi saat kita melakukan koneksi ke database MySQL di server dari client dalam satu jaringan, dapat dilakukan dengan melakukan langkah berikut:

1. Masuk ke command prompt di Windows atau terminal di Linux:
 mysql -u root -p  
2. Kemudian jalankan query berikut:
 USE mysql;  
 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;  

Salam Slacker.. ;)



Sumber: Internet.

Senin, 24 November 2014

Puji Syukur untuk Android telah diupdate

by Unknown  |  in Android at  Senin, November 24, 2014
Aplikasi Puji Syukur untuk Android sudah diupdate ke versi 1.4. Silahkan dicoba da mohon komentarnya :).


*CATATAN: Jika saat update terjadi error, bersihkan cache aplikasi atau install ulang aplikasi akan menyelesaikan masalah.

Fitur:
* Berbagi bacaan ke media sosial.
* Menandai bacaan yang penting.
* Personalisasi tampilan dengan tema.
* Personalisasi latar belakang dengan warna yang bisa dipilih sendiri.
* Personalisasi latar belakang dengan gambar


Aplikasi dapat didownload di:
https://play.google.com/store/apps/details?id=com.rilixtech.pujisyukur

Jumat, 21 November 2014

Rilis BukuEnde, Aplikasi Buku Ende terbaru di Android

by Unknown  |  in Android at  Jumat, November 21, 2014

Akhirnya, setelah dari bulan september merilis versi Beta dari BukuEnde, kemarin tanggal 20 November 2014 aplikasi BukuEnde telah tersedia di Play Store.

Mohon membantu pengembangan aplikasi ini lebih lanjut dengan memberikan donasi..;)

Fitur-fitur:
1. Pencarian lagu berdasarkan judul dan nomornya.
2. Menandai lagu untuk dibaca kemudian
3. Lagu dikategorikan berdasarkan bagian bukunya.
4. Personalisasi aplikasi dengan tema.
5. Desain sederhana dan menarik
6. Midi lagu sudah disertakan sehingga kita tidak perlu lagi mendownloadnya saat memutar lagu.
7. Dapat bekerja dengan baik di mode portrait atau landscape.
8. Bebas dari iklan.

Minggu, 19 Oktober 2014

Error after Android Support Library to version 21

by Unknown  |  in Pengenalan Pemrograman Menggunakan Java at  Minggu, Oktober 19, 2014
At 17 October 2014 Google release Android 5.0 as Android API 21. As an Android developer, I promptly to download and applying it to my applications and update all of my . Because all of my applications depends on AppCompat I also update the Android Support Library to version 21. FYI, I use eclipse Juno as my main IDE.

After updating the AppCompat, all of my applications getting some error. Trying to go back to Android Support Library version 20 to get them working again but fail because there is no turning back to version 20 after updated.

Fortunately, the solution is very simple. Just open the project.properties for the AppCompat project folder and change the target value to android-21