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.app.Activity; | |
import android.os.Bundle; | |
import android.widget.Toast; | |
public class MainActivity extends Activity implements ObservableScrollView.ScrollViewListener { | |
private ObservableScrollView mScrollView; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); |
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
Display display = getWindowManager().getDefaultDisplay(); | |
int width = 0; | |
int height = 0; | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { | |
Point size = new Point(); | |
display.getSize(size); | |
width = size.x; | |
height = size.y; | |
} else { | |
// Before API level 13 |
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
line one | |
line two | |
line three |
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
// inside activities | |
LayoutInflater inflater = getLayoutInflater(); | |
// outside activities | |
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE ); |
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.app.Activity; | |
import android.os.Bundle; | |
import android.widget.ArrayAdapter; | |
import android.widget.TextView; | |
import android.widget.Toast; | |
public class MainActivity extends Activity implements ObservableListView.ListViewListener { | |
private ObservableListView mListView; |
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
/** | |
* A custom DialogFragment that is positioned above given "source" component. | |
* | |
* @author Jonik, http://stackoverflow.com/a/20419231/56285 | |
*/ | |
public class ConfirmBox extends DialogFragment { | |
private View source; | |
public ConfirmBox() { | |
} |