This file contains hidden or 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
if (ImagePicker.shouldHandle(requestCode, resultCode, data)) { | |
Image image = ImagePicker.getFirstImageOrNull(data); | |
Uri uri = Uri.fromFile(new File(image.getPath())); | |
StorageReference tempat = storageReference.child("user").child(auth.getUid()).child("profil.jpg"); | |
UploadTask uploadTask = tempat.putFile(uri); | |
uploadTask.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() { | |
@Override | |
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { | |
Log.d("BERHASIL","adalah:"+taskSnapshot); |
This file contains hidden or 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
Intent ambilGambar = new Intent(Intent.ACTION_PICK); | |
ambilGambar.setType("image/*"); | |
startActivityForResult(ambilGambar,PILIH_PHOTO); | |
// |
This file contains hidden or 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
// object model | |
var objectModel = { | |
nama:"paijo", | |
satu:function(){ | |
this.nama += "gunawan"; | |
}, | |
get namaNya(){ | |
return this.nama; |
This file contains hidden or 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
This is a classic issue with asynchronous web APIs. You cannot return something now that hasn't been loaded yet. With other words, you cannot simply create a global variable and use it outside onDataChange() method because it will always be null. This is happening because onDataChange() method is called asynchronous. Depending on your connection speed and the state, it may take from a few hundred milliseconds to a few seconds before that data is available. | |
But not only Firebase Realtime Database loads data asynchronously, almost all of modern other web APIs do, since it may take some time. So instead of waiting for the data (which can lead to unresponsive application dialogs for your users), your main application code continues while the data is loaded on a secondary thread. Then when the data is available, your onDataChange() method is called and can use the data. With other words, by the time onDataChange() method is called your data is not loaded yet. | |
Let's take an example, by placing a few log statemen |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | |
<gradient android:startColor="@color/colorBiru" android:centerColor="@color/colorTransparant" android:endColor="@color/colorTransparant" android:angle="270"/> | |
</shape> |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> | |
<solid android:color="@color/colorTransparant"> | |
</solid> | |
<corners android:radius="10dp"> | |
</corners> | |
<stroke android:width="1dp" android:color="@color/colorBiru" > | |
</stroke> | |
</shape> |
This file contains hidden or 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
package com.malik.rajapickup; | |
import android.app.Dialog; | |
import android.content.Intent; | |
import android.net.Uri; | |
import android.support.annotation.NonNull; | |
import android.support.annotation.Nullable; | |
import android.support.v7.app.AlertDialog; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.util.Log; |
This file contains hidden or 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
private OnClickListener btnClick = new OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
// TODO Auto-generated method stub | |
} | |
}; | |
//passing listener object to button | |
make_move.setOnClickListener(btnClick); |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<manifest ...> | |
<application ...> | |
<activity | |
android:name=".TestInputActivity" | |
android:label="@string/title_activity_test_input" | |
android:windowSoftInputMode="adjustResize" | |
android:theme="@style/AppTheme.NoActionBar"> | |
</activity> | |
</application> |
This file contains hidden or 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
if (TextUtils.isEmpty(updateEditNamaProfile.getText().toString().trim())){ | |
updateEditNamaProfile.setError("Gak Bole Kosong"); | |
return; | |
} |