Events | Performance | Crashs | Http requests | Problems | |
---|---|---|---|---|---|
Fabric | Easy to implement and very neat to read | No | Ver easy to understand, includes memory usage | No | Limited |
AppDynamics | Configurable | Something like it | Automatic, a lot of info, but not neat | Automatic, its awesome! Has everything! | Compile time went from 7 to |
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 AlarmBroadcaster extends BroadcastReceiver { | |
@Override | |
public void onReceive(Context context, Intent intent) { | |
//Remember in the SetAlarm file we made an intent to this, this is way this work, otherwise you would have to put an action | |
//and here listen to the action, like in a normal receiver | |
createNotification(context); | |
} | |
public void createNotification(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
//This code is highly summarized | |
private int height; | |
private Timer timer; | |
private int leafFallDuration = 6000; | |
private int leafRotationDuration = 900; | |
@Override | |
public 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
public class TabsAdapter extends FragmentStatePagerAdapter { | |
//Add this method to all the other override methods | |
public int getPageIcon(int position) { | |
Integer id; | |
switch (position){ | |
case 0: | |
id = R.layout.layout_example; | |
break; |
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
//We will simply pass two ScrollViews to our method. | |
//This is not perfect cause you have to syncScrolls(first, second), and then syncScrolls(second, first) | |
//Please look at the xml below, the views to pass should be rightHeader, rightBody and viceversa | |
private void syncScrolls(final HorizontalScrollView currentView, final HorizontalScrollView otherView) { | |
GestureDetector.SimpleOnGestureListener gestureListener = new GestureDetector.SimpleOnGestureListener() { | |
@Override | |
public boolean onDoubleTap(MotionEvent e) { | |
return true; |
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
Intent broadcast = new Intent(); | |
broadcast.setAction("YourBroadcastKey"); | |
broadcast.putExtra("extraKey", value); | |
sendBroadcast(broadcast); |
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
Intent goToActivity = new Intent(YourCurrentActivity.this, OtherActivity.class); | |
startActivity(goToActivity); | |
//The first param in setClass() is the context, usually can be YourCurrentActivity.this but also can be, | |
//this, getApplicationContext, getContext, or Contex context if variable context was initialized before |
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
//Create the inner class before extending it, yes obvious, but sometimes can be forgotten | |
public class CustomRecyclerAdapter extends RecyclerView.Adapter<CustomAdapter.ViewHolder> { | |
//Sometimes you can have your set of data as empty but initialized and then update it using an update method | |
//This is usefull when you want to do an http request, set the adapter empty then when the AsyncTask is done, refresh it | |
private List<YourObject> mObjects = new ArrayList(); | |
//There is no constructor matching the super here, so create your own with what ever you need | |
public CustomAdapter() { | |
} |
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"?> | |
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item> | |
<bitmap | |
android:gravity="bottom|center_horizontal" | |
android:src="@mipmap/ic_drag_handle_white_18px" /> | |
</item> | |
</layer-list> |
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
/*CUSTOM LAYOUT*/ | |
Dialog dialog = new Dialog(context); | |
dialog.setContentView(R.layout.dialog_background_primary_dark); | |
//Then to find a view inside the custom layout use the dialog as root view | |
EditText inputEt = (EditText) dialog.findViewById(R.id.inputEt); | |
/*FULLSCREEN*/ | |
//The style below can be replaced by any fullscreen style, you can create a fullscreen activity and use that style | |
Dialog fullScreen = new Dialog(context, android.R.style.Theme_Black_NoTitleBar_Fullscreen); |
OlderNewer