Search This Blog

Thursday, March 15, 2012

Easter Egg In Galaxy Nexus

The Old Man : "This is funny. If you have Galaxy Nexus. Just Go to [Setting -> About Phone] and tabs repeatedly (fast) on [Android Version] then you will see ... Nyan Ice-cream Android !!"



 By using two fingers doing zoom ... Wow !! 

UPDATE: And if you just keep enlarge it .... Nyan !!

Wednesday, March 7, 2012

I just bought Galaxy Nexus !!

The old man : "Yep. Just like I said before. I would buy a new device for (fun) development. And yesterday, I just bought Samsung Galaxy Nexus. I just waited for a few months until the price was getting down to reasonable price that I could buy it. Please take a look..."

 Here is an unboxing video ...


 Look nice ...


Why not ? It's Galaxy Nexus ...

Wednesday, February 22, 2012

Porting Activity to Fragment

Oldman : "Now for Honeycomb and above phones or tablets, The Activity design method has been replace with Fragment. I spent many days learned how to porting the old Activity method source code to new Fragment. Hope this can be useful for the others... "

1.Replace main menu Activity with FragmentActivity (This is mean that I'm using Android "support libraries" instead of real Fragment api. That because I need to back porting this to running on the old devices also)

public class MainActivity extends FragmentActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }  
   
}

 Yes, there is not much things inside MainActivity class but just calling setContentView method to set view for R.layout.main which is ...

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    <fragment class="com.myapp.TitlesFragment"
            android:id="@+id/titles"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
</FrameLayout>
At res/layout/main.xml and ...

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="horizontal" >

    <fragment class="com.myapp.TitlesFragment"
        android:id="@+id/fragment1"
        android:layout_weight="1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
 
    <FrameLayout android:id="@+id/details"
            android:layout_weight="1"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
 </LinearLayout>
At res/layout-land/main.xml

2.Create TitlesFragment class (just like they described here)

3.Change others Activity type to Fragment type. Here is somethings you need to change ...
   - onBackPressed() method must be remove.
   - Add onCreateView() method. Move all code in onCreate() method to onCreateView() method.
   - Change 'this.' to 'this.getActivity().'
   - To access view components, use 'View view = inflater.inflate(R.layout.find_scanner_view, container, false);'
   - Be careful about this.getActivity().finish(); because in this case it means go finish the application.
   - They said to using onSaveInstanceState() method to saving UI state but it seems not working probably what I expected it will. So I using SharedPreferences to save UI state and restoring them at onCreateView() method. 
   - Add xxxFragmentActivity inside the Fragment class...

public class BFragment extends Fragment implements OnClickListener,Runnable{
   ....

  public static class BFragmentActivity extends FragmentActivity {
     ....
  }

}
4. Connect to converted Fragment classes through FragmentManager (learn from the example)
5. To sending result between Fragment classes and TitlesFragment class, just override setTargetFragment() method and calling it to passing caller Fragment reference.

     static Fragment targetFragment;
     static int targetRequestCode;
     @Override
     public void setTargetFragment(Fragment fragment, int requestCode){
         super.setTargetFragment(fragment, requestCode);
         targetFragment=fragment;
         targetRequestCode=requestCode;
     }

OK, This is just the point of view. In details, May be you need more homework to do. For my opinion, I think to making new app with Fragment should be a better choice than trying to porting old app to it ... it was painful job ...

Cheers,

Monday, February 13, 2012

So sad Valentine's day ... :(

During of this below website ->
http://blogs.computerworld.com/19341/android_40_upgrade_list#SamsungGalaxyTab7

It's seem my dear Galaxy Tab (SC-01C) won't be upgrade to Ice-cream sandwich.
May be it's time to look for another device..

My choices are Motorola Xoom or wait until Galaxy Nexus's price is getting little bit lower than now... I will let you know later ...

The old man.

Thursday, January 5, 2012

Add more languages support directly into .apk file

Oldman : "Recently my boss wanted me to add more languages support directly into my Android application .apk file without using my sourcecode. I don't know why he need that but I found the way to do this."

1.Go and install android-apktool
http://code.google.com/p/android-apktool/

2.Using apktool to decode the orignal .apk file (the file must not be sign yet or it will broke and can not be install later)

# apktool if xxxx.apk
# apktool d xxxx.apk

3.then xxxx folder was created. inside them place res/values-zz/strings.xml file where zz is your addition language (ex: ja for japanese, it for italy)

4. rebuild the resource.

# apktool b ./xxxx/ xxxx-new.apk

5. then open xxxx-new.apk and xxxx.apk with zip manager program(or something like that) drag resource.arse file from xxxx-new.apk and drop into xxxx.apk 

6. sign xxxx.apk with jarsigner and your key. Then your xxxx.apk file can be install and should be supporting for new languages....
http://developer.android.com/guide/publishing/app-signing.html

Note: I did this on my Debian x86 machine.

Thursday, October 20, 2011

Ice cream Sandwich Emulator

Last night , I just heard that Ice cream Sandwich release news. So, I tried to updated the SDK.... After 30 minutes the SDK was updated and I tried to make a new ADV. It was reach to the welcome screen.

After retried almost 10 times, Then I could make it !!
These were what I did ...
1. Don't scale the Emulator's screen.
2. At Emulator RAM setting , increase RAM from 512 to 1024
3. Start Emulator and wait ...

Here are what I got !!






Tuesday, September 6, 2011

Quadrant Standard on Galaxy Tab Froyo vs Gingerbread

Old man : "Good news for today. Last time benchmark race between Galaxy Tab Froyo and Gingerbread didn't give result that show me the merit of updated my tab to Gingerbread. Today by using Quadrant Standard benchmark, it gave better score for Gingerbread tab... I hope I can count on this result."

Quadrant Standard result on Froyo Galaxy Tab.

Quadrant Standard result on Gingerbread Galaxy Tab.