Posts

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

Image from gallery or camera in Android .

Image
Add dependency in gradle. implementation 'com.github.Mariovc:ImagePicker:1.0.5' On Button Click Call. fp .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { search_earn_money8 .setVisibility(View. VISIBLE ); ImagePicker. setMinQuality ( 600 , 800 ); ImagePicker. pickImage (Report. this , "Select your image:" ); } }); @Override protected void onActivityResult( int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK && data.getData() != null ) { bitmaps = ImagePicker. getImageFromResult ( this , requestCode, resultCode, data); Uri uri = data.getData(); getRealPathFromURI(uri); search_earn_money8 .setImageBitmap( bitmaps );// set image on imageview. } // TODO do something with the bitmap } private String getRealPathFromURI(Uri contentURI) { thePath = "no-path-found" ; String[] filePathColumn =

GIF image on imageview in android.

Add this dependencies  in gradle. allprojects {     repositories {        mavenCentral()     } } dependencies {     compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.+' } <pl.droidsonroids.gif.GifImageView     android:layout_width="match_parent"     android:layout_height="match_parent"     android:src="@drawable/gif_file" />

Admob Native Banner In Android

    activity_main.xml:  < android:id="@+id/adView"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_alignParentBottom="true"         android:layout_centerHorizontal="true"         ads:adSize="BANNER"         ads:adUnitId="@string/banner_home_footer"></com.google.android.gms.ads.AdView> Mainactivity.java    mAdView = (AdView) findViewById(R.id.adView);         mAdView.setAdSize(AdSize.BANNER);         mAdView.setAdUnitId(getString(R.string.banner_home_footer));         AdRequest adRequest = new AdRequest.Builder()  .build();

Create Div and drag through jquery.

Image
<html> <head>       <meta charset="utf-8">       <style>         body {             margin: 0;             padding: 0;             overflow: hidden;             background-color: #F0F0F0;         } body { font-family: Arial, Helvetica, sans-serif; } table { font-size: 1em; } .ui-draggable, .ui-droppable { background-position: top; }     </style> <link rel="stylesheet" type="text/css" href="../css/normalize.css" /> <link rel="stylesheet" type="text/css" href="../fonts/font-awesome-4.3.0/css/font-awesome.min.css" /> <link rel="stylesheet" type="text/css" href="../css/demo.css" /> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <style&

Navigation Drawer and Custom listview

Image
Userpanel.java package com.alexatechno.; import android.app.ProgressDialog; import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.app.ActionBarDrawerToggle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.NavigationView; import android.support.design.widget.Snackbar; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; import org.apache