Skip to content

Instantly share code, notes, and snippets.

View fnzainal's full-sized avatar
🏠
Working from home

Zainal Fahrudin fnzainal

🏠
Working from home
View GitHub Profile
@Override
public void onStop() {
super.onStop();
//params listAdapter, name of ExpandableListAdapter
for (int i =0;i<listAdapter.getGroupCount();i++){
//params expListView, name of ExpandableListView
expListView.collapseGroup(i);
}
}
@fnzainal
fnzainal / SetText on header NavigationDrawer
Created November 27, 2015 13:27
Get id view on header Navigation Drawer
View header = LayoutInflater.from(this).inflate(R.layout.nav_header_main, null);
navigationView.addHeaderView(header);
strUid = (TextView)header.findViewById(R.id.tvUsername);
strUid.setText(uid);
@fnzainal
fnzainal / Wifi Debugging
Last active December 1, 2015 00:07
debugging apps from android studio via wifi
cd android-sdks/platform-tools/
./adb connect [ip android device]
./adb devices
@fnzainal
fnzainal / material_edit_text.xml
Created November 28, 2015 00:13
EditText with material design
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/etThink"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="what do you think?"
/>
@fnzainal
fnzainal / RequestVolley.java
Created December 1, 2015 09:44
request json data with volley
private void getDataRequest() {
String url= "";
RequestQueue queue = Volley.newRequestQueue(getActivity());
StringRequest postRequest = new StringRequest(Request.Method.GET, url,
new Response.Listener<String>()
{
@Override
public void onResponse(String response) {
progress.dismiss();
Log.d("response", response);
@fnzainal
fnzainal / Timer.java
Created December 2, 2015 02:34
example using Timer android
Timer timer = new Timer();
@Override
public void onCreate()
{
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
CallMethod();
}
@fnzainal
fnzainal / Fungsi.java
Last active December 8, 2015 07:42
Contoh penggunaan fungsi dasar pada java
package fungsi;
public class Fungsi {
public static void main(String[] args){
double a=50.51;
int b= -234;
String aca=" contoh String";
String tes="uji.coba";
System.out.println("double a=50.51;");
@fnzainal
fnzainal / Using Intent & bundle
Created February 12, 2016 13:40
Passing Values Between Activities with Bundle
//on first activity
Intent intent = new Intent(First.this,Second.class);
intent.putExtra("string_id",str_id);
startActivity(intent);
//on second activity
Bundle bundle = getIntent().getExtras();
if (bundle!=null){
str_nama = bundle.getString("string_id");
@fnzainal
fnzainal / GlideWithHeader.java
Created March 19, 2016 13:34
adding header on url glide image loader
GlideUrl glideUrl = new GlideUrl(url, new LazyHeaders.Builder()
.addHeader("key","value").build());
Glide.with(getApplicationContext())
.load(glideUrl)
.into(imageView);
@fnzainal
fnzainal / MaterialDialogInputText.java
Created April 12, 2016 04:27
show dialog to input text with lib Material Dialogs
import com.afollestad.materialdialogs.MaterialDialog.Builder;
new MaterialDialog.Builder(this)
.content("Enter your name")
.inputRange(5,20)
.cancelable(false)
.inputType(InputType.TYPE_TEXT_FLAG_CAP_WORDS)
.input("your name", null, new MaterialDialog.InputCallback() {
@Override
public void onInput(MaterialDialog dialog, CharSequence input) {