Tuesday, 19 September 2017
3. After Spacific Minium sdk API 23 Select Lolipop 5.0
Subscribe to:
Post Comments (Atom)
Blog purpose for android basic example for android app developer. any query please my contact





package com.example.calling;
import android.content.Intent;
import android.net.Uri;
import android.provider.ContactsContract;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class Calling extends AppCompatActivity {
EditText edittext1;
Button button1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_calling);
edittext1=(EditText)findViewById(R.id.editText);
button1=(Button)findViewById(R.id.button1);
//Performing action on button click
button1.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View arg0) {
String number=edittext1.getText().toString();
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:"+number));
startActivity(callIntent);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
// getMenuInflater().inflate(R.menu.activity_main, menu);
// ArrayList numbersArrayList=getIntent().getExtras().getStringArrayList("phoneNumbers");
return true;
}
public void rt(View view){
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setType(ContactsContract.Contacts.CONTENT_TYPE);
startActivity(intent);
}
}
<?xml version="1.0" encoding="utf-8"?>
<?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:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="taskreminderapp.techsect.com.techlock.MainActivity">
<ImageButton
android:layout_width="50dp"
android:layout_height="wrap_content"
android:id="@+id/imageButton"
android:src="@drawable/ru"
android:background="@drawable/roundcorner"
android:padding="1dp"
android:onClick="rt"
android:layout_weight="0.21"
android:elevation="0dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="29dp"
android:layout_marginEnd="29dp"
android:layout_marginTop="23dp"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="phone"
android:ems="10"
android:id="@+id/editText"
android:layout_below="@+id/imageButton"
android:layout_toLeftOf="@+id/imageButton"
android:layout_toStartOf="@+id/imageButton"
android:layout_marginRight="14dp"
android:layout_marginEnd="14dp"
android:layout_marginTop="47dp"
android:textColorLink="?android:attr/textColorPrimaryInverse"
android:textColor="?android:attr/navigationBarColor" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:layout_centerVertical="true"
android:layout_alignLeft="@+id/editText"
android:layout_alignStart="@+id/editText"
android:layout_marginLeft="49dp"
android:layout_marginStart="49dp" />
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.calling">
<uses-permission android:name="android.permission.CALL_PHONE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
<resources> <string name="app_name">Calling</string> <string name="hello_world">Hello world!</string> <string name="menu_settings">Settings</string> <string name="title_activity_main">MainActivity</string> </resources>
Improving Android App Performance is one of the most important tasks for any Android developer. A slow app, high loading time, UI lag, or ...
No comments:
Post a Comment