public String getFilename() {
filepath = Environment.getExternalStorageDirectory().getPath();
file = new File(filepath, "Hair");
if (!file.exists()) {
file.mkdirs();
}
return (file.getAbsolutePath() + "/"
+ String.valueOf(System.currentTimeMillis()) + ".png");
}
Wednesday, 8 May 2013
How to Make a Directory in SDCARD
How to make global Class
public class AppConfig {
Context context;
public AppConfig(Context mxt) {
context = mxt;
}
public static String filepath = null;
public static String imageupload = null;
public static Bitmap abjustbitmap = null;
}
other activity to use
AppConfig config;
Context context;
in oncreate method
context = getApplicationContext();
config = new AppConfig(context);
Tapping form field in WebView and open soft keyboard
webview.requestFocus(View.FOCUS_DOWN);
webview.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_UP:
if (!v.hasFocus()) {
v.requestFocus();
}
break;
}
return false;
}
});
Map in android
These are the important link for using map in android.
Display current location on Google Map:
http://wptrafficanalyzer.in/blog/showing-current-location-in-google-maps-with-gps-and-locationmanager-in-android/
http://www.androidhive.info/2012/01/android-working-with-google-maps/
http://android-er.blogspot.in/2009/11/display-marker-on-mapview-using.html
http://android-codes-examples.blogspot.in/2011/04/google-map-example-in-android-with-info.html
http://android-er.blogspot.in/2012/06/add-mylocationoverlay-on-openstreetmap.html
http://android-er.blogspot.in/2012/05/create-multi-marker-openstreetmap-for.html
Map with Map overlay:
http://androidcodesnips.blogspot.in/2011/08/gooogle-maps-for-android.html
http://android-coding.blogspot.in/2011/08/detect-touch-on-marker-in-mapview.html
Route Map in Android:
Uri uri = Uri.parse("http://maps.google.com/maps?&saddr=slat,slon&daddr=dlat,dlon");
Here saddr -> source address
daddr -> destination address
slat -> source latitude
slon -> source longitude
dlat -> destination latitude
dlon -> destination longitude
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
Google MapV2:
http://ramsandroid4all.blogspot.in/2013/03/google-maps-android-api-v2.html
Display current location on Google Map:
http://wptrafficanalyzer.in/blog/showing-current-location-in-google-maps-with-gps-and-locationmanager-in-android/
http://www.androidhive.info/2012/01/android-working-with-google-maps/
http://android-er.blogspot.in/2009/11/display-marker-on-mapview-using.html
http://android-codes-examples.blogspot.in/2011/04/google-map-example-in-android-with-info.html
http://android-er.blogspot.in/2012/06/add-mylocationoverlay-on-openstreetmap.html
http://android-er.blogspot.in/2012/05/create-multi-marker-openstreetmap-for.html
Map with Map overlay:
http://androidcodesnips.blogspot.in/2011/08/gooogle-maps-for-android.html
http://android-coding.blogspot.in/2011/08/detect-touch-on-marker-in-mapview.html
Route Map in Android:
Uri uri = Uri.parse("http://maps.google.com/maps?&saddr=slat,slon&daddr=dlat,dlon");
Here saddr -> source address
daddr -> destination address
slat -> source latitude
slon -> source longitude
dlat -> destination latitude
dlon -> destination longitude
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
Google MapV2:
http://ramsandroid4all.blogspot.in/2013/03/google-maps-android-api-v2.html
I will be happy if you will provide your feedback or follow this blog. Any suggestion and help will be appreciated.
Thank you :)
List View in android Example
Today i am posting sample code custom list view using inflate serves with custom layouts.
-->Create lyt_view.xml in res folder
<?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:orientation="vertical" android:background="@drawable/raw_selector">
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingRight="5dp" >
<LinearLayout
android:id="@+id/linearLayout3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingLeft="5dp" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:paddingTop="2dp" >
<TextView
android:id="@+id/lyt_txt_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:ellipsize="end"
android:gravity="center_vertical"
android:singleLine="true"
android:text="Name"
android:textColor="@color/darkGrey1"
android:textSize="16dp"
android:textStyle="bold" />
<TextView
android:id="@+id/lyt_txt_distance"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:ellipsize="end"
android:gravity="center_vertical"
android:singleLine="true"
android:text="1234.56"
android:textColor="@color/black"
android:textSize="12dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:paddingTop="5dp" >
<TextView
android:id="@+id/lyt_txt_add"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:ellipsize="end"
android:gravity="center_vertical"
android:singleLine="true"
android:text="Name"
android:textColor="@color/darkGrey2"
android:textSize="12dp" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:gravity="center_vertical"
android:singleLine="true"
android:text="mile away"
android:textColor="@color/darkGrey2"
android:textSize="12dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout4"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:id="@+id/imgbtn_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/arrow" />
</LinearLayout>
</LinearLayout>
<TextView
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="@color/darkGrey1" />
</LinearLayout>
//Implementation class of custom list view
private LayoutInflater lyt_Inflater = null;
private ItemsAdapter adpt;
private ListView Listview;
ItemsAdapter adpt=new ItemsAdapter(Act_Parking.this,arr_phm);
Listview.setAdapter(adpt);
Listview.invalidate();
-->This is custom adapter for inflate row in listview.
private class ItemsAdapter extends BaseAdapter
{
private ArrayList<pharmacists> arrphm;
public ItemsAdapter(Context context,ArrayList<pharmacists> items)
{
this.arrphm = items;
}
@Override
public int getCount()
{
return arrphm.size();
}
@Override
public Object getItem(int position)
{
return null;
}
@Override
public long getItemId(int position)
{
return 0;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent)
{
View view_lyt = convertView;
try
{
if(arr_phm.size()>0)
{
final pharmacists phmst =arr_phm.get(position);
String Name=phmst.name;
String Distance=phmst.distance;
String ParkingType=phmst.parking_type_name;
lyt_Inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view_lyt = lyt_Inflater.inflate(R.layout.lyt_view,null);
TextView txtnm=(TextView) view_lyt.findViewById(R.id.lyt_txt_name);
txtnm.setText(Name);
TextView txtdistance=(TextView) view_lyt.findViewById(R.id.lyt_txt_distance);
txtdistance.setText(Distance);
TextView txtadd=(TextView) view_lyt.findViewById(R.id.lyt_txt_add);
txtadd.setText("Parking Type:"+" "+ParkingType);
view_lyt.setBackgroundResource(R.drawable.raw_selector);
view_lyt.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
Constants.CODE_TAB=3;
Intent i=newIntent(Act_Parking.this,Act_Details.class);
i.putExtra("ID", position);
startActivity(i);
}
});
}
}
catch (Exception e)
{
Log.i("Exception==", e.toString());
}
return view_lyt;
}
}
Simple list view:
http://www.coderzheaven.com/2012/01/08/single-selection-listview-in-android/
http://www.androidhive.info/2011/10/android-listview-tutorial/
List With icon/Custom Adapter:
http://www.javasrilankansupport.com/2012/05/android-listview-example-with-image-and.html
http://www.coderzheaven.com/2011/03/25/android-image-listview/
http://www.androidhive.info/2012/02/android-custom-listview-with-image-and-text/
Filter in List view:
http://www.coderzheaven.com/2011/12/14/flitering-a-listview-using-an-input-from-an-edittext-in-android/
List with Load more:
http://www.androidhive.info/2012/03/android-listview-with-load-more-button/
List with Section:
http://www.coderzheaven.com/2012/02/24/listview-with-sections-in-android/
List with layout inflate:
http://android-codes-examples.blogspot.in/2011/03/customized-listview-items-selection.html
Expandable List:
http://www.coderzheaven.com/expandable-listview-android-simpleexpandablelistadapter-simple-example/
http://myandroidsolutions.blogspot.in/2012/08/android-expandable-list-example.html
I will be happy if you will provide your feedback or follow this blog. Any suggestion and help will be appreciated.
Thank you :)
Subscribe to:
Posts (Atom)