Skip to content

Instantly share code, notes, and snippets.

View ar-android's full-sized avatar
:octocat:
NULL

Ahmad Rosid ar-android

:octocat:
NULL
View GitHub Profile
@ar-android
ar-android / currency
Last active September 23, 2023 07:57
set currency EditText
private void setCurrency(final EditText edt) {
edt.addTextChangedListener(new TextWatcher() {
private String current = "";
@Override
public void onTextChanged(CharSequence s, int start, int before,
int count) {
}
public void sendEmail(String string1){
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("application/image");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{string1});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"Test Subject");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "From My App");
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///mnt/sdcard/Myimage.jpeg"));
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
public class Laxio {
public static ArrayList<String> arrayPermutasi;
public static void main(String[] args) {
arrayPermutasi = new ArrayList<String>();
String Str = "1234";
permutasiString(Str);
@ar-android
ar-android / GsonDezerialize.java
Created July 9, 2015 05:33
Dezerialize gson custom
public class CategoryDezerializer implements JsonDeserializer<ListCategory> {
@Override
public ListCategory deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context)
throws JsonParseException {
final JsonObject jsonObject = json.getAsJsonObject();
final JsonElement jsonID = jsonObject.get("ID");
@ar-android
ar-android / SetHeightListview.java
Created August 17, 2015 07:43
This is how to set listview based on scrollview
public static void setListViewHeightBasedOnChildren(ListView listView) {
ListAdapter listAdapter = listView.getAdapter();
if (listAdapter == null) {
// pre-condition
return;
}
int totalHeight = 0;
for (int i = 0; i < listAdapter.getCount(); i++) {
View listItem = listAdapter.getView(i, null, listView);
@ar-android
ar-android / Tab.java
Created September 2, 2015 04:26
This is for cuztomizing tab indicator
//Customizing Tab indicator
PagerTabStrip pagerTabStrip = (PagerTabStrip) findViewById(R.id.pager_header);
pagerTabStrip.setDrawFullUnderline(true);
pagerTabStrip.setTabIndicatorColor(getResources().getColor(R.color.icons));
for (int i = 0; i < pagerTabStrip.getChildCount(); ++i) {
View nextChild = pagerTabStrip.getChildAt(i);
if (nextChild instanceof TextView) {
TextView tv = (TextView) nextChild;
tv.setTextColor(getResources().getColor(R.color.icons));
Upload Project on github
- Git config --global user.name "username anda"
- Git config --global user.email isi_dengan_email_anda@ymail.com
- Git init
- Git add *
- Git commit –m "versi 1.0.0"
- Git pull origin master
- Git push origin master
@ar-android
ar-android / RoundedImageView.java
Created September 11, 2015 07:28
RoundedImageView
package id.ocit.aksimum.extendview;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
@ar-android
ar-android / Ripple Effect
Created September 14, 2015 23:51
Create simple ripple effect
dependencies {
compile 'com.github.traex.rippleeffect:library:1.3'
}
<com.andexert.library.RippleView
android:id="@+id/rect"
rv_centered="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
h.rippleView = (RippleView) view.findViewById(R.id.rect);
@ar-android
ar-android / StringToArray.java
Created September 30, 2015 03:48
Split comma and create array from string with comma
String str = "http://1.bp.blogspot.com/-huU2LE_jd64/VcWhPWiVlgI/AAAAAAAB3TY/rhEjlFqT3k4/s1600/01.jpg, http://4.bp.blogspot.com/-NQ69kOrdDR4/VcWhP_OnyRI/AAAAAAAB3Tg/qVK_gWB2Xtk/s1600/02.jpg, http://4.bp.blogspot.com/-N-YBUev9L4Q/VcWhP4eT7iI/AAAAAAAB3Tc/FURv3WXZ0gI/s1600/03.jpg, http://3.bp.blogspot.com/-sD0voY50m3o/VcWhQ2pSZnI/AAAAAAAB3Tw/k9Hy3J_EvdU/s1600/04.jpg, http://4.bp.blogspot.com/-oe8ggexHGUk/VcWhRjWZw_I/AAAAAAAB3T0/PoN9-UfaeCc/s1600/05.jpg,http://4.bp.blogspot.com/-ICqCe72dxNc/VcWhRhZTyDI/AAAAAAAB3T4";
ArrayList aList= new ArrayList(Arrays.asList(str.split(",")));
for(int i=0;i<aList.size();i++)
{
System.out.println(String.valueOf(i)+aList.get(i));
}