This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://forums.devx.com/showthread.php?t=143327 | |
import java.text.ParseException; | |
import java.text.SimpleDateFormat; | |
import java.util.Date; | |
public class DateDifference { | |
public static SimpleDateFormat dateFormat = new SimpleDateFormat( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String readFileToString(String path) { | |
try { | |
InputStream inputStream = null; | |
String result = null; | |
FileConnection fileConnection = (FileConnection) Connector.open( | |
path, Connector.READ_WRITE); | |
if (fileConnection.exists()) { | |
inputStream = fileConnection.openInputStream(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String args[]){ | |
StringBuffer angkaRibuan = new StringBuffer(); | |
String angka = "145745487665"; | |
putCommas(angka, angkaRibuan); | |
System.out.println(angkaRibuan.toString()); | |
} | |
public static void tambahinTitik(String number, StringBuffer angkaRibuan) { | |
if (number.length() <= 3) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SplashActivity extends Activity { | |
private final int SPLASH_DISPLAY_LENGHT = 3000; // delay time | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.splash); | |
new Handler().postDelayed(new Runnable() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Class for parsing date input with format(dd-mm-yyy). | |
* If you want to get a day in date please use parseDate(String date) | |
* If you want to get a month in date please use parseMonth(String date) | |
* If you want to get a year in date please use parseYear(String date) | |
* If you want to convert Integer to String please use integerToString(int value) | |
*/ | |
public class StringUtil { | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class IntegerUtil { | |
/* | |
how to use: | |
String number = "12345678"; | |
int value = IntegerUtil.stringToInteger(number); | |
*/ | |
public static int stringToInteger(String s) throws NumberFormatException { | |
int num = 0; | |
for (int i = 0; i < s.length(); i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public String readStringFromAssetsFile(String pathFileName) { | |
String data = ""; | |
try { | |
InputStream inputStream = getAssets().open(pathFileName); | |
InputStreamReader inputStreamReader = new InputStreamReader( | |
inputStream); | |
BufferedReader bufferedReader = new BufferedReader( | |
inputStreamReader); | |
String line = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Don't forget to add package SmartImageView in your project | |
*/ | |
private ImageView imageView; | |
private SmartImageView smartImageView; | |
private String imageUrl = "http://onebit.co/assets/img/logo_lubang.png"; | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
smartImageView = (ImageView)findViewById(R.id.smartImage); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SampleAsyckTask extends Activity { | |
private final String BASE_URL = "http://search.twitter.com/search.json?q=onebitmedia"; | |
private Button btn; | |
private ProgressDialog dialog; | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_ramalan); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Don't forget to add LoopJ library on your Project | |
*/ | |
public class SampleLoopJActivity extends Activity { | |
private final String BASE_URL = "http://search.twitter.com/search.json?q=onebitmedia"; | |
private Button btn; | |
private ProgressDialog dialog; | |
@Override |