Posts

Showing posts from 2016

android wifi debugging without root android studio

step 1:-   goto terminal step 2:-  goto your sdk path and open platform-tools step 3:- like this E:\android setup\sdk\platform-tools step 4:-    adb tcpip 5555 step 5:- find the IP address with  adb shell netcfg step 6:- adb connect <DEVICE_IP_ADDRESS>:5555 now ready for connect and u want to disconnect adb -s <DEVICE_IP_ADDRESS>:5555 usb   to switch back when done.

android.intent.action.MAIN

get all background notification message on your current Activity in your background service.java Intent i = new Intent( "android.intent.action.MAIN" ); i.putExtra( "isNet" , true ); context.sendBroadcast(i); in your Activity where you want data declare----- private BroadcastReceiver mReceiver ; try { this .unregisterReceiver( this . mReceiver ); } catch (Exception ex) { } mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { //-----------here you get data from intent } }; this .registerReceiver( mReceiver , new IntentFilter( "android.intent.action.MAIN" ));

open date picker on button click event

btn.setOnClickListener(new OnClickListener() { @TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public void onClick(View v) { // TODO Auto-generated method stub final Calendar c = Calendar.getInstance(); int mYear = c.get(Calendar.YEAR); int mMonth = c.get(Calendar.MONTH); int mDay = c.get(Calendar.DAY_OF_MONTH); // Launch Date Picker Dialog DatePickerDialog dpd = new DatePickerDialog( SurveyMain.this, new DatePickerDialog.OnDateSetListener() { @TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public void onDateSet( DatePicker view, int year, int monthOfYear, int dayOfMonth) { GregorianCalendar gc = new GregorianCalendar(); gc.add(Calendar.DATE, 1); datetomoroow = gc.getTime(); c.set(Calendar.YEAR, year); c.set(Calendar.MONTH,

Full Screen Dialog

void showDialogOfMsg() { Dialog dialog = new Dialog(getActivity()); dialog.requestWindowFeature(Window. FEATURE_NO_TITLE ); dialog.setContentView(R.layout. dialog_of_msg_list ); int width = getActivity().getWindowManager().getDefaultDisplay().getWidth(); LinearLayout lay = (LinearLayout)dialog.findViewById(R.id. lay ); ViewGroup.LayoutParams params = lay.getLayoutParams(); params. width = width; lay.setLayoutParams(params); dialog .show(); } other way Window window = introDialog.getWindow(); DisplayMetrics displaymetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); int widthContentView = displaymetrics.widthPixels - 5; int heightContentView = displaymetrics.heightPixels - 10; window.setLayout(widthContentView , heightContentView);

General Class

database helper :- https://drive.google.com/file/d/0B1dF4YSBqUooNjBCVDZiYm8zc00/view?usp=sharing Constant Data :- https://drive.google.com/file/d/0B1dF4YSBqUooWkg1bXppSjUzdzA/view?usp=sharing GPS Tracker :- https://drive.google.com/file/d/0B1dF4YSBqUooa0FVTmpFQmVQTHc/view?usp=sharing Adp with view holder:- private class ViewHolder { private TextView tv_title; public ViewHolder(View v) { tv_title = (TextView) v.findViewById(R.id. tv_title ); } } public class Adp extends BaseAdapter { @Override public int getCount() { return data .size(); } @Override public Object getItem( int position) { return position; } @Override public long getItemId( int position) { return position; } @Override public View getView( final int position, View convertView, ViewGroup parent) { ViewHolder holder; Layout

w7chat

gradle file //----------- xmpp--------- compile 'org.igniterealtime.smack:smack-android:4.1.4' compile 'org.igniterealtime.smack:smack-tcp:4.1.4' compile 'org.igniterealtime.smack:smack-im:4.1.4' compile 'org.igniterealtime.smack:smack-extensions:4.1.4' menifiest.xml < uses-permission android :name= "android.permission.ACCESS_NETWORK_STATE" /> < uses-permission android :name= "android.permission.INTERNET" /> < uses-permission android :name= "android.permission.RECEIVE_BOOT_COMPLETED" /> < service android :name= "cygnus.w7chat.xmpp.XmppService" android :enabled= "true" /> ConstantDataOfXMPP.java import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.location.Location; import android.os.Handler; import android.os.Looper; import android.util.Log; import android.widget.Toast; import org.