this code works charm @ dial screen want auto make call. have changed action_dial action call , still no luck. have give full access in manifest still not doing want to. please help.
edittext firstnumber; button btnadd; int number = 35; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main23); toast.maketext(main23activity.this, "type in pin number", toast.length_long).show(); btnadd = (button)findviewbyid(r.id.button12); btnadd.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { try { edittext et = (edittext) findviewbyid(r.id.edittext6); string text= et.geteditabletext().tostring(); string character = character.tostring((char) number); toast.maketext(main23activity.this, "adding money account has never been easy", toast.length_long).show(); intent intent = new intent(intent.action_dial, uri.parse("tel:" + uri.encode("*221*" + text + "#"))); startactivity(intent); } catch (exception e) { } } }); }
}
manifest file
<uses-permission android:name="android.permission.call_phone"> <uses-permission android:name="android.permission.access_fine_location" /> <uses-permission android:name="android.permission.access_coarse_location"/> </uses-permission> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsrtl="true" android:theme="@style/apptheme" > <activity android:screenorientation="portrait" android:name=".mainactivity" android:label="@string/app_name" android:theme="@style/apptheme.noactionbar" > <uses-permission android:name="android.permission.send_sms" /> <uses-permission android:name="android.permission.call_phone" /> <uses-permission android:name="android.permission.camera" /> <uses-feature android:name="android.hardware.camera" /> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.default" /> </intent-filter> </activity> <activity android:name="splashscreen" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name=".main2activity" /> <activity android:name=".main22activity" /> <activity android:name=".main23activity" > </activity><!-- attention: auto-generated add google play services project app indexing. see https://g.co/appindexing/androidstudio more information. --> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> </application>
dial below , don't forget add relevant permission manifest:
<uses-permission android:name="android.permission.call_phone" />
uri number = uri.parse("tel:123456789"); intent callintent = new intent(intent.action_dial, number); startactivity(callintent);
Comments
Post a Comment