Apr
24
2012

Android OpenGL Texture Problem

while i was working on http://www3.ntu.edu.sg/home/ehchua/programming/android/Android_3D.htm examples i have faced a problem . Example 2.9  Example 6a: Photo-Cube was not working as expected. There is no image texture, instead of images ,cube sides are white. I haved checked all the possible mistakes,bugs ... but there is no problem. Then i changed the device.It was motorolo droid(2.2.2).On h... [More]
Mar
12
2012

Android Popup Dialog Theme

http://code.google.com/p/android/issues/detail?id=4394 i hate this issue. i have tried to open an activity, some time popup some time normal theme. So, as expected in run time to chose theme i coded  super.setTheme(android.R.style.Theme_Dialog); super.onCreate(savedInstanceState); setContentView(R.layout.layout); but it is not working as expected. i spent lots of time and tried lots of thi... [More]
Mar
12
2012

RoboGuice, IoC with Guice in android

In this post ,i will introduce roboguice ,i will not explain what is IoC or why IoC.You can find lost of motivations if you google. First step is extending AbstractAndroidModule and Overriding configure method.In this module , we will bind one type to another. public class IoCModule extends AbstractAndroidModule { @Override protected void configure() { bind(IUserReposi... [More]
Mar
5
2012

More than one listener for button click

Problem : Button has only one OnClickListener . In rare situations ,we want to set more than one listener to the button. after filtering some business logic, it is good to add listeners when logic condition fits.   Solution : in a decorated button class, which holds a List<OnClickListener> . Then instead of seting listener ,we can add listeners. public class DecoratedButton e... [More]
Feb
27
2012

Long running AsyncTask Sleep Problem

Problem :when your asyncTask process time is longer then your phone sleep time ,phone will sleep before doInBackground returns T.After your phone wake , your  asyncTask will start again if it executes in onResume. Solution :  @Override protected T doInBackground(Void... params) { PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); PowerManager.WakeLock w... [More]
Feb
23
2012

Dependency Injection Patterns

Constructor Injection When you guarantee that dependency class or parameter is always available to the class which we initialize, Constructor Injection is my favorite. Client  must supply dependencies via public constructor. without a IoC container . But prefer using a container if you want your code more loosely-coupled, highly-cohesive . So... time to code.     &nbs... [More]
Feb
21
2012
Ajax // MongoDB // MVC

Simple mvc ajax paging with Mongodb

First use  MongoCursor<TDocument> SetSkip(int skip) while paging collection , do not use  public static IEnumerable<TSource> Skip<TSource>(this IEnumerable<TSource> source, int count) also do not use  public static IEnumerable<TSource> Take<TSource>(this IEnumerable<TSource>&nb... [More]
Feb
17
2012
MVC

Simple TextBox/Area Character Count with MVC @Html.TextAreaFor

with simple MvcHtmlString Extension and simple javascript input can be restricted for character count. To do this,simply add System.ComponentModel.DataAnnotations.StringLengthAttribute to the model property.  Download Source : CharactersRemaining.rar (2.17 mb)