Showing posts from November, 2013

Simple drawing example in Android

This post is a simple drawing example using Canvas, BitMap, Paint and Path classes from Android.

import java.util.ArrayList; import; import android.content.Context; import; import; import; import; import; import android.os.Bundle; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup.LayoutParams; import android.widget.LinearLayout; public class DrwaingActivity extends Activity { View mView; private Paint mPaint; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); LinearLayout layout = (LinearLayout) findViewById(; mView = new DrawingView(this); layout.addView(mView, new LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT))…

Simple Sliding Menu Example in Android

Consider using simple NavigationView instead of this old sliding menu , which based on Material design and much simpler and very flexible than this Navigation drawer.

This post will help you to create a simple sliding menu in Android.
Here sliding menu is a listview which is in INVISIBLE state. It will comes to VISIBLE state once you click the menu button. And it will go to INVISIBLE state again once you pick the item from listview. To change the state we are using animation, that is why it looks like sliding.

Complete code:

package; import android.os.Bundle; import; import; import; import; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; …