Posts

Slider with bullet in android.

Add Dependency in gradle: implementation 'com.github.smarteist:autoimageslider:1.3.2-appcompat' implementation 'com.github.bumptech.glide:glide:4.10.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0' Add in Xml < androidx.cardview.widget.CardView xmlns: android = "http://schemas.android.com/apk/res/android" xmlns: app = "http://schemas.android.com/apk/res-auto" android :layout_width= "fill_parent" android :layout_height= "wrap_content" android :orientation= "horizontal" app :cardCornerRadius= "3dp" app :cardUseCompatPadding= "true" > < com.smarteist.autoimageslider.SliderView android :id= "@+id/imageSlider" android :layout_width= "match_parent" android :layout_height= "220dp" app :sliderAnimationDuration= "600" app :sliderA...

Linearlayout in bottom of screen in android.

Image
<? xml version= "1.0" encoding= "utf-8" ?> < LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" android :layout_width= "fill_parent" android :layout_height= "wrap_content" android :background= "#fff" android :layout_alignParentBottom= "true" android :orientation= "vertical" > < LinearLayout android :layout_width= "fill_parent" android :layout_height= "wrap_content" android :orientation= "horizontal" > < LinearLayout android :id= "@+id/la2" android :layout_width= "fill_parent" android :layout_height= "35dp" android :gravity= "center" android :layout_margin= "5dip" android :layout_weight= "1" android :orientation= "vertical" > ...

Surfaceview with camera in android.

Image
Add Surfaceview in xml. < SurfaceView android :id= "@+id/surfaceView" android :layout_width= "fill_parent" android :layout_height= "fill_parent" /> public class Home extends BaseActivity implements SurfaceHolder.Callback{ Camera camera ; SurfaceView surfaceView ; SurfaceHolder surfaceHolder ; PictureCallback jpegCallback ; protected void onCreate(Bundle savedInstanceState) { surfaceView = (SurfaceView) findViewById(R.id. surfaceView ); target = (Button) findViewById(R.id. target ); target1 = (Button) findViewById(R.id. target1 ); surfaceHolder = surfaceView .getHolder(); surfaceHolder .addCallback( this ); // deprecated setting, but required on Android versions prior to 3.0 surfaceHolder .setType(SurfaceHolder. SURFACE_TYPE_PUSH_BUFFERS ); jpegCallback = new PictureCallback() { public void onPictureTaken( byte [] data, Camera camera) { FileOutputStream outStream = null ; try { outStr...

VolleyMultipartRequest in android

Gradle: implementation 'com.mcxiaoke.volley:library:1.0.18' VolleyMultipartRequest.java import com.android.volley.AuthFailureError; import com.android.volley.NetworkResponse; import com.android.volley.ParseError; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.HttpHeaderParser; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.Map; public class VolleyMultipartRequest extends Request<NetworkResponse> { private final String twoHyphens = "--" ; private final String lineEnd = " \r\n " ; private final String boundary = "apiclient-" + System. currentTimeMillis (); private Response.Listener<NetworkResponse> mListener ; private Response.ErrorListener mE...