welcome folks
FAQ in android,FAQ in dotnet,DotNet, C#,DOT NET CODE, ASP.NET, VB.NET, TRICKS,Dotnetcode,Android and Latest Technology Articles in VB,Android and ASP.NET

Friday, August 31, 2012

How to send SMS to Multiple User in asp.net?

Please Refer the below links.

 http://www.codeproject.com/Articles/20064/How-to-Send-SMS-Messages-from-C-using-an-SQL-Datab

what is the uses of getElementById and ClientId In Asp.net

if (document.getElementById('<%=txtUserId.ClientId %>').value == "") { 
alert('Username is Mandtory'); 
return false; 
} 

from your question 

<%=txtUserId.ClientId %> this statement is used to access server control ID in asp.net from javascript code & plz use this 
<%=txtUserId.ClientID %> 
in place of this <%=txtUserId.ClientId %> check difference

Wednesday, August 29, 2012

How to get Contact Number or list in android application?


There are three steps to this process.
1) Permissions
Add a permission to read contacts data to your application manifest.
<uses-permission android:name="android.permission.READ_CONTACTS"/>
2) Calling the Contact Picker
Within your Activity, create an Intent that asks the system to find an Activity that can perform a PICK action from the items in the Contacts URI.
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
Call startActivityForResult, passing in this Intent (and a request code integer, PICK_CONTACT in this example). This will cause Android to launch an Activity that's registered to support ACTION_PICKon the People.CONTENT_URI, then return to this Activity when the selection is made (or canceled).
startActivityForResult(intent, PICK_CONTACT);
3) Listening for the Result
Also in your Activity, override the onActivityResult method to listen for the return from the 'select a contact' Activity you launched in step 2. You should check that the returned request code matches the value you're expecting, and that the result code is RESULT_OK.
You can get the URI of the selected contact by calling getData() on the data Intent parameter. To get the name of the selected contact you need to use that URI to create a new query and extract the name from the returned cursor.
@Override
public void onActivityResult(int reqCode, int resultCode, Intent data) {
  super.onActivityResult(reqCode, resultCode, data);

  switch (reqCode) {
    case (PICK_CONTACT) :
      if (resultCode == Activity.RESULT_OK) {
        Uri contactData = data.getData();
        Cursor c =  managedQuery(contactData, null, null, null, null);
        if (c.moveToFirst()) {
          String name = c.getString(c.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
          // TODO Whatever you want to do with the selected contact name.
        }
      }
      break;
  }
}

How to Close and Hide Android Soft KeyBoard?


You can force Android to hide the virtual keyboard using the InputMethodManager, callinghideSoftInputFromWindow, passing in the token of the window containing your edit field.
InputMethodManager imm = (InputMethodManager)getSystemService(
      Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);

How to declare global variable in android?


class MyApp extends Application {

  private String myState;

  public String getState(){
    return myState;
  }
  public void setState(String s){
    myState = s;
  }
}
class Blah extends Activity {

  @Override
  public void onCreate(Bundle b){
    ...
    MyApp appState = ((MyApp)getApplicationContext());
    String state = appState.getState();
    ...
  }
}

How to save Activity state in android?

You need to override onSaveInstanceState(Bundle savedInstanceState) and write the application state values you want to change to the Bundle parameter like this:


@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
  super.onSaveInstanceState(savedInstanceState);
  // Save UI state changes to the savedInstanceState.
  // This bundle will be passed to onCreate if the process is
  // killed and restarted.
  savedInstanceState.putBoolean("MyBoolean", true);
  savedInstanceState.putDouble("myDouble", 1.9);
  savedInstanceState.putInt("MyInt", 1);
  savedInstanceState.putString("MyString", "Welcome back to Android");
  // etc.
}
The Bundle is essentially a way of storing a NVP ("Name-Value Pair") map, and it will get passed in toonCreate and also onRestoreInstanceState where you'd extract the values like this:
@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
  super.onRestoreInstanceState(savedInstanceState);
  // Restore UI state from the savedInstanceState.
  // This bundle has also been passed to onCreate.
  boolean myBoolean = savedInstanceState.getBoolean("MyBoolean");
  double myDouble = savedInstanceState.getDouble("myDouble");
  int myInt = savedInstanceState.getInt("MyInt");
  String myString = savedInstanceState.getString("MyString");
}

Thursday, August 23, 2012

Difference between the px, dp, dip and sp used in Android?


px
Pixels - corresponds to actual pixels on the screen.
in
Inches - based on the physical size of the screen.
mm
Millimeters - based on the physical size of the screen.
pt
Points - 1/72 of an inch based on the physical size of the screen.
dp
Density-independent Pixels - an abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen. The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion. Note: The compiler accepts both "dip" and "dp", though "dp" is more consistent with "sp".
·         If running on hdpi device 150x150 px image will take up 100*100 dp of screen space.
·         If running on mdpi device 150x150 px image will take up 150*150 dp of screen space.
·         If running on xhdpi device 150x150 px image will take up 75*75 dp of screen space.

sp
Scale-independent Pixels - this is like the dp unit, but it is also scaled by the user's font size preference. It is recommend you use this unit when specifying font sizes, so they will be adjusted for both the screen density and user's preference.