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
// Start dial app | |
Intent intent = new Intent(Intent.ACTION_DIAL); | |
intent.setData(Uri.parse("tel:1234-12345678")); | |
startActivity(intent); | |
// Make a call directly | |
Intent intent = new Intent(Intent.ACTION_CALL); | |
intent.setData(Uri.parse("tel:1234-12345678")); | |
startActivity(intent); |
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
<?xml version="1.0" encoding="utf-8"?> | |
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<ListView | |
android:id="@+id/list" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" |
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 LoadingDialogFragment extends DialogFragment { | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setStyle(STYLE_NO_FRAME, android.R.style.Theme_Dialog); | |
} | |
@Override | |
public void onStart() { | |
super.onStart(); |
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
package com.yourpackage.yourapp; | |
import android.content.Context; | |
import android.graphics.drawable.Drawable; | |
import android.util.AttributeSet; | |
import android.widget.ImageView; | |
public class AspectRatioImageView extends ImageView { | |
public AspectRatioImageView(Context context) |
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
<uses-permission android:name="android.permission.READ_CONTACTS" /> |
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
import android.os.Parcel; | |
import android.os.Parcelable; | |
/** | |
* Created by Albert on 14-4-30. | |
*/ | |
public class NameParcelable implements Parcelable { | |
private String firsName; | |
private String lastName; |
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
// in getView() of an adapter | |
TextView text = ViewHolder.get(view, R.id.id_of_text_view); | |
text.setText("Hello world!"); |
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 DateUtils { | |
public static String convertDateFormat(String time, String fromFormat, String toFormat, String failure) { | |
SimpleDateFormat from = new SimpleDateFormat(fromFormat); | |
SimpleDateFormat to = new SimpleDateFormat(toFormat); | |
Date date = from.parse(time, new ParsePosition(0)); | |
if (date == null) { | |
return failure; | |
} else { | |
return to.format(date); | |
} |
OlderNewer