Note that there are some explanatory texts on larger screens.

plurals
  1. POcommunication between two device using sms
    primarykey
    data
    text
    <p>I want my program to be able to receive sms from a special number("+9856874236").</p> <p>I want application to be recive SMS ,if the SMS is contain "enable wifi" ,then change wifi to enable </p> <p>i 'm using this code but it working crash??</p> <p>MainActivity</p> <pre><code>package com.example.sms; import android.app.Activity; import android.content.Context; import android.net.wifi.WifiManager; import android.os.Bundle; import android.view.Menu; import android.widget.TextView; public class MainActivity extends Activity { static TextView messageBox; static String x=""; static Context context; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); messageBox=(TextView)findViewById(R.id.messageBox); check(); } //How to used other or many activity @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); return true; } public static void updateMessageBox(String msg,String from) { messageBox.append(msg); //Get parent phone number from database //check parent number with ... if(msg.equals("enable wifi")) { x="yes"; MainActivity objSampleClass = new MainActivity(); objSampleClass.check(); } //context.startActivity(new Intent(context, MainActivity.class)); //Intent i=new Intent(context, p1.class); //context.startActivity(i); } public void check() { if(x.equals("yes")) { WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); wifi.setWifiEnabled(true); } else { } } } </code></pre> <p>manifest</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.sms" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /&gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name="com.example.sms.MainActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;receiver android:name="com.example.sms.TextMessageReceiver" &gt; &lt;intent-filter&gt; &lt;action android:name="android.provider.Telephony.SMS_RECEIVED" /&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; &lt;activity android:name="com.example.sms.Test" android:label="@string/title_activity_test" &gt; &lt;/activity&gt; &lt;/application&gt; &lt;uses-permission android:name="android.permission.RECEIVE_SMS" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE" &gt; &lt;/uses-permission&gt; &lt;uses-permission android:name="android.permission.BLUETOOTH"/&gt; &lt;uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/&gt; &lt;uses-permission android:name="android.permission.CHANGE_WIFI_STATE" &gt; &lt;/uses-permission&gt; &lt;/manifest&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload