- http://techblogon.com/alert-dialog-with-edittext-in-android-example-with-source-code/
- http://www.androidhive.info/2012/01/android-json-parsing-tutorial/
- http://webcache.googleusercontent.com/search?q=cache:http://lakyrana.blogspot.com/
- http://developer.android.com/design/style/iconography.html
Friday, June 13, 2014
android help
Code for Sodhpuch free call
MainActivity.java
package com.example.sodhpuchpvtltd;
import java.util.ArrayList;
import android.net.Uri;
import android.os.Bundle;
import android.os.RemoteException;
import android.provider.Contacts.People;
import android.provider.ContactsContract;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.app.Activity;
import android.content.ContentProviderOperation;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Intent;
import android.content.OperationApplicationException;
import android.database.Cursor;
import android.util.Log;
import android.widget.Toast;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
addContact("Sodhpuch Pvt. Ltd.","16600197197");
makeCall();
// Log.i("NativeContentProvider", "Created a new contact, of course hard-coded");
}
//making call fxn
protected void makeCall() {
//Log.i("Make call", "");
Intent phoneIntent = new Intent(Intent.ACTION_CALL);
phoneIntent.setData(Uri.parse("tel:16600197197"));
try {
startActivity(phoneIntent);
finish();
// Log.i("Finished making a call...", "");
} catch (android.content.ActivityNotFoundException ex) {
// Toast.makeText(MainActivity.this,"Call faild, please try again later.", Toast.LENGTH_SHORT).show();
}
}
// creating contact sop
private void addContact(String name, String phone) {
ContentValues values = new ContentValues();
values.put(People.NUMBER, phone);
values.put(People.TYPE, Phone.TYPE_CUSTOM);
values.put(People.LABEL, name);
values.put(People.NAME, name);
Uri dataUri = getContentResolver().insert(People.CONTENT_URI, values);
Uri updateUri = Uri.withAppendedPath(dataUri, People.Phones.CONTENT_DIRECTORY);
values.clear();
values.put(People.Phones.TYPE, People.TYPE_MOBILE);
values.put(People.NUMBER, phone);
updateUri = getContentResolver().insert(updateUri, values);
}
}
SodhpuchPvtLtd.Mainfest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.sodhpuchpvtltd"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.sodhpuchpvtltd.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
package com.example.sodhpuchpvtltd;
import java.util.ArrayList;
import android.net.Uri;
import android.os.Bundle;
import android.os.RemoteException;
import android.provider.Contacts.People;
import android.provider.ContactsContract;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.app.Activity;
import android.content.ContentProviderOperation;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Intent;
import android.content.OperationApplicationException;
import android.database.Cursor;
import android.util.Log;
import android.widget.Toast;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
addContact("Sodhpuch Pvt. Ltd.","16600197197");
makeCall();
// Log.i("NativeContentProvider", "Created a new contact, of course hard-coded");
}
//making call fxn
protected void makeCall() {
//Log.i("Make call", "");
Intent phoneIntent = new Intent(Intent.ACTION_CALL);
phoneIntent.setData(Uri.parse("tel:16600197197"));
try {
startActivity(phoneIntent);
finish();
// Log.i("Finished making a call...", "");
} catch (android.content.ActivityNotFoundException ex) {
// Toast.makeText(MainActivity.this,"Call faild, please try again later.", Toast.LENGTH_SHORT).show();
}
}
// creating contact sop
private void addContact(String name, String phone) {
ContentValues values = new ContentValues();
values.put(People.NUMBER, phone);
values.put(People.TYPE, Phone.TYPE_CUSTOM);
values.put(People.LABEL, name);
values.put(People.NAME, name);
Uri dataUri = getContentResolver().insert(People.CONTENT_URI, values);
Uri updateUri = Uri.withAppendedPath(dataUri, People.Phones.CONTENT_DIRECTORY);
values.clear();
values.put(People.Phones.TYPE, People.TYPE_MOBILE);
values.put(People.NUMBER, phone);
updateUri = getContentResolver().insert(updateUri, values);
}
}
SodhpuchPvtLtd.Mainfest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.sodhpuchpvtltd"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.sodhpuchpvtltd.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Subscribe to:
Posts (Atom)