• This is default featured slide 1 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

  • This is default featured slide 2 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

  • This is default featured slide 3 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

  • This is default featured slide 4 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

  • This is default featured slide 5 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

Find Place Autocomplete Textview

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Html;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AutoCompleteTextView;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.PendingResult;
import com.google.android.gms.location.places.Place;
import com.google.android.gms.location.places.PlaceBuffer;
import com.google.android.gms.location.places.Places;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;

import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.ResultCallback;

public class GoogeAotoText extends AppCompatActivity implements        GoogleApiClient.OnConnectionFailedListener,
        GoogleApiClient.ConnectionCallbacks {
    private static final String LOG_TAG = "MainActivity";
    private static final int GOOGLE_API_CLIENT_ID = 0;
    private AutoCompleteTextView mAutocompleteTextView;

    private GoogleApiClient mGoogleApiClient;
    private PlaceArrayAdapter mPlaceArrayAdapter;
    private TextView mAddressTextView;

    private static final LatLngBounds BOUNDS_MOUNTAIN_VIEW = new LatLngBounds(
            new LatLng(37.398160, -122.180831), new LatLng(37.430610, -121.972090));

    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_googe_aoto_text);
        mGoogleApiClient = new GoogleApiClient.Builder(GoogeAotoText.this)
                .addApi(Places.GEO_DATA_API)
                .enableAutoManage(this, GOOGLE_API_CLIENT_ID, this)
                .addConnectionCallbacks(this)
                .build();
        mAutocompleteTextView = (AutoCompleteTextView) findViewById(R.id
                .etPopupDestination);
        mAutocompleteTextView.setThreshold(3);
        mAddressTextView = (TextView) findViewById(R.id.address);
        mAutocompleteTextView.setOnItemClickListener(mAutocompleteClickListener);
        mPlaceArrayAdapter = new PlaceArrayAdapter(this, android.R.layout.simple_list_item_1,
                BOUNDS_MOUNTAIN_VIEW, null);
        mAutocompleteTextView.setAdapter(mPlaceArrayAdapter);    }

    private AdapterView.OnItemClickListener mAutocompleteClickListener            = new AdapterView.OnItemClickListener() {
        @Override        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            final PlaceArrayAdapter.PlaceAutocomplete item = mPlaceArrayAdapter.getItem(position);
            final String placeId = String.valueOf(item.placeId);
            Log.i(LOG_TAG, "Selected: " + item.description);
            PendingResult<PlaceBuffer> placeResult = Places.GeoDataApi                    .getPlaceById(mGoogleApiClient, placeId);
            placeResult.setResultCallback(mUpdatePlaceDetailsCallback);
            Log.i(LOG_TAG, "Fetching details for ID: " + item.placeId);
        }
    };

    private ResultCallback<PlaceBuffer> mUpdatePlaceDetailsCallback            = new ResultCallback<PlaceBuffer>() {
        @Override        public void onResult(PlaceBuffer places) {
            if (!places.getStatus().isSuccess()) {
                Log.e(LOG_TAG, "Place query did not complete. Error: " +
                        places.getStatus().toString());
                return;
            }
            // Selecting the first object buffer.            final Place place = places.get(0);
            CharSequence attributions = places.getAttributions();
            mAddressTextView.setText(Html.fromHtml(place.getAddress() + ""));
           /* mNameTextView.setText(Html.fromHtml(place.getName() + ""));
            mIdTextView.setText(Html.fromHtml(place.getId() + ""));            mPhoneTextView.setText(Html.fromHtml(place.getPhoneNumber() + ""));            mWebTextView.setText(place.getWebsiteUri() + "");            if (attributions != null) {                mAttTextView.setText(Html.fromHtml(attributions.toString()));            }*/        }
    };

    @Override    public void onConnected(Bundle bundle) {
        mPlaceArrayAdapter.setGoogleApiClient(mGoogleApiClient);
        Log.i(LOG_TAG, "Google Places API connected.");

    }

    @Override    public void onConnectionFailed(ConnectionResult connectionResult) {
        Log.e(LOG_TAG, "Google Places API connection failed with error code: "                + connectionResult.getErrorCode());

        Toast.makeText(this,
                "Google Places API connection failed with error code:" +
                        connectionResult.getErrorCode(),
                Toast.LENGTH_LONG).show();
    }

    @Override    public void onConnectionSuspended(int i) {
        mPlaceArrayAdapter.setGoogleApiClient(null);
        Log.e(LOG_TAG, "Google Places API connection suspended.");
    }
}


-----------------------------****--------------------------------------------------------

layout  :-  activity_googe_aoto_text


<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    tools:context="com.nagraj.customiamge.GoogeAotoText">
    <AutoCompleteTextView        android:id="@+id/etPopupDestination"        android:layout_width="0dp"        android:layout_height="wrap_content"        android:layout_weight="1"        android:background="@null"
        android:drawablePadding="5dp"        android:hint="Search destination"        android:imeOptions="actionDone"        android:inputType="textNoSuggestions"        android:paddingLeft="10dp"        android:paddingRight="2dp"        android:singleLine="true"        android:textColor="#FFFFFF"        android:textSize="25dp" >

        <requestFocus />
    </AutoCompleteTextView>
    <TextView        android:id="@+id/address"        android:layout_width="wrap_content"        android:layout_height="wrap_content"       />


    </LinearLayout>


--------------------*******************--------------------------------

Adapter  :-- PlaceArrayAdapter

        import android.content.Context;
        import android.util.Log;
        import android.widget.ArrayAdapter;
        import android.widget.Filter;
        import android.widget.Filterable;
        import android.widget.Toast;

        import com.google.android.gms.common.api.GoogleApiClient;
        import com.google.android.gms.common.api.PendingResult;
        import com.google.android.gms.common.api.Status;
        import com.google.android.gms.location.places.AutocompleteFilter;
        import com.google.android.gms.location.places.AutocompletePrediction;
        import com.google.android.gms.location.places.AutocompletePredictionBuffer;
        import com.google.android.gms.location.places.Places;
        import com.google.android.gms.maps.model.LatLngBounds;

        import java.util.ArrayList;
        import java.util.Iterator;
        import java.util.concurrent.TimeUnit;

public class PlaceArrayAdapter
        extends ArrayAdapter<PlaceArrayAdapter.PlaceAutocomplete> implements Filterable {
    private static final String TAG = "PlaceArrayAdapter";
    private GoogleApiClient mGoogleApiClient;
    private AutocompleteFilter mPlaceFilter;
    private LatLngBounds mBounds;
    private ArrayList<PlaceAutocomplete> mResultList;

    /**     * Constructor     *     * @param context  Context     * @param resource Layout resource     * @param bounds   Used to specify the search bounds     * @param filter   Used to specify place types     */    public PlaceArrayAdapter(Context context, int resource, LatLngBounds bounds,
                             AutocompleteFilter filter) {
        super(context, resource);
        mBounds = bounds;
        mPlaceFilter = filter;
    }

    public void setGoogleApiClient(GoogleApiClient googleApiClient) {
        if (googleApiClient == null || !googleApiClient.isConnected()) {
            mGoogleApiClient = null;
        } else {
            mGoogleApiClient = googleApiClient;
        }
    }

    @Override    public int getCount() {
        return mResultList.size();
    }

    @Override    public PlaceAutocomplete getItem(int position) {
        return mResultList.get(position);
    }

    private ArrayList<PlaceAutocomplete> getPredictions(CharSequence constraint) {
        if (mGoogleApiClient != null) {
            Log.i(TAG, "Executing autocomplete query for: " + constraint);
            PendingResult<AutocompletePredictionBuffer> results =
                    Places.GeoDataApi                            .getAutocompletePredictions(mGoogleApiClient, constraint.toString(),
                                    mBounds, mPlaceFilter);
            // Wait for predictions, set the timeout.            AutocompletePredictionBuffer autocompletePredictions = results
                    .await(60, TimeUnit.SECONDS);
            final Status status = autocompletePredictions.getStatus();
            if (!status.isSuccess()) {
                Toast.makeText(getContext(), "Error: " + status.toString(),
                        Toast.LENGTH_SHORT).show();
                Log.e(TAG, "Error getting place predictions: " + status
                        .toString());
                autocompletePredictions.release();
                return null;
            }

            Log.i(TAG, "Query completed. Received " + autocompletePredictions.getCount()
                    + " predictions.");
            Iterator<AutocompletePrediction> iterator = autocompletePredictions.iterator();
            ArrayList resultList = new ArrayList<>(autocompletePredictions.getCount());
            while (iterator.hasNext()) {
                AutocompletePrediction prediction = iterator.next();
                resultList.add(new PlaceAutocomplete(prediction.getPlaceId(),
                        prediction.getFullText(null)));
            }
            // Buffer release            autocompletePredictions.release();
            return resultList;
        }
        Log.e(TAG, "Google API client is not connected.");
        return null;
    }

    @Override    public Filter getFilter() {
        Filter filter = new Filter() {
            @Override            protected FilterResults performFiltering(CharSequence constraint) {
                FilterResults results = new FilterResults();
                if (constraint != null) {
                    // Query the autocomplete API for the entered constraint                    mResultList = getPredictions(constraint);
                    if (mResultList != null) {
                        // Results                        results.values = mResultList;
                        results.count = mResultList.size();
                    }
                }
                return results;
            }

            @Override            protected void publishResults(CharSequence constraint, FilterResults results) {
                if (results != null && results.count > 0) {
                    // The API returned at least one result, update the data.                    notifyDataSetChanged();
                } else {
                    // The API did not return any results, invalidate the data set.                    notifyDataSetInvalidated();
                }
            }
        };
        return filter;
    }

    class PlaceAutocomplete {

        public CharSequence placeId;
        public CharSequence description;

        PlaceAutocomplete(CharSequence placeId, CharSequence description) {
            this.placeId = placeId;
            this.description = description;
        }

        @Override        public String toString() {
            return description.toString();
        }
    }
}

----------------------------*******************----------------------------

manifest:-


<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"    package="com.nagraj.customiamge">

    <uses-permission android:name="android.permission.INTERNET" />
    <!--plase -->    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>



    <application        android:allowBackup="true"        android:icon="@mipmap/ic_launcher"        android:label="@string/app_name"        android:roundIcon="@mipmap/ic_launcher_round"        android:supportsRtl="true"        android:theme="@style/AppTheme">
       
        <activity android:name=".GoogeAotoText">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <meta-data            android:name="com.google.android.geo.API_KEY"            android:value="Your key"/>
        <meta-data            android:name="com.google.android.gms.version"            android:value="@integer/google_play_services_version"/>

    </application>

</manifest>


---------------------------------------*********************-------------------------------

dependencies :-
    compile 'com.google.android.gms:play-services-places:10.2.1'
Share:

Pick multiple images from gallery OR Custom gallery

import android.content.ClipData;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Parcelable;
import android.provider.MediaStore;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.ClipboardManager;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;

import java.util.ArrayList;

import static android.R.attr.action;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    Button camera,gallery;
    private LinearLayout lnrImages;
    private Button btnAddPhots;
    private Button btnSaveImages;
    private ArrayList<String> imagesPathList;
    private Bitmap yourbitmap;
    private Bitmap resized;
    private final int PICK_IMAGE_MULTIPLE =1;
private final int SELECT_PHOTO =2;
private ArrayList<String>photos;
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); camera = (Button) findViewById(R.id.camera); gallery = (Button) findViewById(R.id.gallery); camera.setOnClickListener(this); gallery.setOnClickListener(this); } @Override public void onClick(View v) { if(v == camera){
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
photoPickerIntent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);

photoPickerIntent.setType("image/*");
startActivityForResult(photoPickerIntent, SELECT_PHOTO);
} if(v == gallery){ Intent intent = new Intent(MainActivity.this,CustomPhotoGalleryActivity.class); startActivityForResult(intent,PICK_IMAGE_MULTIPLE); } }
Share:

zz

https://github.com/ddanny/achartengine/blob/master/achartengine/demo/org/achartengine/chartdemo/demo/chart/PieChartBuilder.java
Share:

RecyclerView

Add dependencies

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'    compile 'com.android.support:appcompat-v7:24.2.1'


    compile 'com.android.support:recyclerview-v7:24.1.1'    compile 'com.android.support:design:24.1.1'
}

----------------------------***-------------------------------

main class


package com.wdp.recyclerviewdemo;

import android.graphics.Movie;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.wdp.recyclerviewdemo.Adapter.MoviesAdapter;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {
    RecyclerView recyclerList;
    private MoviesAdapter mAdapter;
    private List<String> movieList = new ArrayList<>();

    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        movieList.add("nagjee");
        movieList.add("Harsh");
        movieList.add("Gaurav");

        recyclerList = (RecyclerView) findViewById(R.id.recyclerList);
        mAdapter = new MoviesAdapter(movieList);
        RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext(), LinearLayoutManager.VERTICAL, false);
        recyclerList.setLayoutManager(mLayoutManager);

        recyclerList.setAdapter(mAdapter);

        //prepareMovieData();    }

   /* private void prepareMovieData() {        Movies movies = new Movies("Mad Max: Fury Road", "Action & Adventure", "2015");        movieList.add(movies);    }*/}

__________________________________________________***________________

layout  


<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent">

    <android.support.v7.widget.RecyclerView        android:id="@+id/recyclerList"        android:layout_width="match_parent"        android:layout_height="wrap_content">
   </android.support.v7.widget.RecyclerView>
</RelativeLayout>




_______________________***______________________-

Adapter 

import android.content.Context;
import android.graphics.Movie;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.wdp.recyclerviewdemo.Movies;
import com.wdp.recyclerviewdemo.R;

import java.util.ArrayList;
import java.util.List;


public class MoviesAdapter extends RecyclerView.Adapter<MoviesAdapter.MyViewHolder> {
    Context context;
    LayoutInflater layoutInflater;
    private List<String> moviesLists;

    public MoviesAdapter(List<String> movieList) {
        this.moviesLists = movieList;
    }

    @Override    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.movie_list_row, parent, false);
        return new MyViewHolder(itemView);
    }

    @Override    public void onBindViewHolder(MyViewHolder holder, int position) {
        holder.title.setText(moviesLists.get(position));

    }

    @Override    public int getItemCount() {
        return moviesLists.size();
    }

    class MyViewHolder extends RecyclerView.ViewHolder {
        private TextView title, genre, year;

        public MyViewHolder(View itemView) {
            super(itemView);
            title = (TextView) itemView.findViewById(R.id.title);
            genre = (TextView) itemView.findViewById(R.id.genre);
            year = (TextView) itemView.findViewById(R.id.year);
        }
    }
}


-------------------**-------------------------------
layout



<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:padding="10dp">

    <TextView        android:hint="dfsd"        android:id="@+id/title"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:layout_alignParentTop="true"        android:padding="10dp"        android:textColor="@android:color/black"        android:textSize="16dp"        android:textStyle="bold" />

    <TextView        android:id="@+id/genre"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:layout_below="@id/title"        android:padding="10dp"        android:textColor="@android:color/black" />

    <TextView        android:id="@+id/year"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_alignParentRight="true"        android:padding="10dp"        android:text="dgfdhgjhhg"        android:textColor="@android:color/black" />
</RelativeLayout>


--------------------------***------------------------------

model class


public class Movies {
    private String title, genre, year;

    public Movies() {
    }

    public Movies(String title, String genre, String year) {
        this.title = title;
        this.genre = genre;
        this.year = year;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String name) {
        this.title = name;
    }

    public String getYear() {
        return year;
    }

    public void setYear(String year) {
        this.year = year;
    }

    public String getGenre() {
        return genre;
    }

    public void setGenre(String genre) {
        this.genre = genre;
    }
}

Share:
Powered by Blogger.

Recent Posts

Unordered List

  • Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
  • Aliquam tincidunt mauris eu risus.
  • Vestibulum auctor dapibus neque.

Theme Support

Need our help to upload or customize this blogger template? Contact me with details about the theme customization you need.