coding
hi please can you contact me personally about something i am working on a project and find your code really helpful.
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.razormist.sendsmsapp.MainActivity"> <EditText android:id="@+id/et_contact" android:layout_height="wrap_content" android:layout_width="match_parent" android:inputType="number" android:hint="Contact Number"/> <EditText android:id="@+id/et_message" android:layout_height="250dp" android:layout_width="match_parent" android:hint="Message" android:inputType="textMultiLine" android:gravity="left" android:layout_below="@+id/et_contact"/> android:id="@+id/btn_send" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_below="@+id/et_message" android:layout_centerHorizontal="true" android:text="send"/> </RelativeLayout>
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.razormist.sendsmsapp"> <uses-permission android:name="android.permission.SEND_SMS" /> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity" android:configChanges="orientation" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
Button btn_send; EditText et_contact, et_message;
private void PermissionToConnect(){ if(ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.SEND_SMS) != PackageManager.PERMISSION_GRANTED){ if(ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this, Manifest.permission.SEND_SMS)){ }else{ } } } @Override if(requestCode == 1) { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.SEND_SMS) == PackageManager.PERMISSION_GRANTED) { Toast.makeText(this, "Access", Toast.LENGTH_SHORT).show(); } } else { Toast.makeText(this, "Denied", Toast.LENGTH_SHORT).show(); } } }
et_contact = (EditText)findViewById(R.id.et_contact); et_message = (EditText)findViewById(R.id.et_message); PermissionToConnect(); @Override try{ SmsManager smsManager = SmsManager.getDefault(); smsManager.sendTextMessage(number, null, message, null, null); Toast.makeText(MainActivity.this, "Sent", Toast.LENGTH_SHORT).show(); Toast.makeText(MainActivity.this, "Sending Failed", Toast.LENGTH_SHORT).show(); } } });
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.
Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE:
1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.