android


Sending Sms by intent but when press back button its not resuming my application


here is my sms() function. when calling intent its work properly but when i press back button then its directly put me on home screen and not resuming my application
public class SmsActivity extends AppCompatActivity {
EditText number;
Button smsBtn;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sms);
number=(EditText)findViewById(R.id.etNumber);
smsBtn=(Button)findViewById(R.id.btn_sms);
smsBtn.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
sms(number.getText().toString());
}
});
}
void sms(String contact_number) {
try {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setType("vnd.android-dir/mms-sms");
String number = "sms:" + contact_number;
i.setData(Uri.parse(number));
startActivity(i);
} catch (ActivityNotFoundException e) {
Toast.makeText(getParent(), "SMS cannot be sent", Toast.LENGTH_LONG).show();
}
}
}
please help me.. Thank you.
You need a flag for that by which you can determine that you need to call super.onbackpress();
or send sms.
I think you are doing both action together
Check your Manifest First,may be for SMSActivity you might have used
android:noHistory="true"
whatever code you have posted it should resume your activity when back pressed

Related Links

Does Google insist on using Wallet exclusively, or can my app offer both Wallet and PayPal?
REST API Client Library for Android
Detect if TextView spans over 2 lines
Android - Drop Shadow to Button
How can I get the compass bearing regardless of device orientation?
How to make my app not visible in market only for android 4.03 and 4.04 versions?
How to respond to HTTP authentication challenges in Android
Stop Android webview covering tabwidget
$.mobile.changePage don't work
Security Exception when trying to access a Picasa image on device running 4.2
Which is best for android automation calabash or UIAutomator api
Android 4.2: IllegalstateException: One or more children of this LayerDrawable does not have constant state
Optimal thread pool size in android
Start a telephone on textview click
How to Play Audio File on Android ICS 4.0.3 and 4.0.4
onActivityResult() not called in new nested fragment API

Categories

HOME
shell
sonarqube
search
css3
gpu
google-spreadsheet
shiro
jtextpane
vert.x
character
resultset
rtf
automatic-ref-counting
intercom
dynatrace
zerobrane
capistrano3
microsoft-dynamics-nav
aws-sdk
shortest-path
nodemcu
drive
visual-glitch
kendo-mobile
ios10.2
jquery-callback
mat
underscore.js
corenlp-server
autodesk-designautomation
linkedhashmap
openwhisk
installscript
batching
cd
release
metaprogramming
jvmti
setup.py
numberpicker
vmware-fusion
portforwarding
chronicle-map
rfc3339
opencmis
fwrite
linter
serde
magic-draw
pair-programming
ngmaterial
mach-o
rxtx
renaming
reachability
stax
reporting-services-2012
myspace
tinkerpop3
hclust
refinerycms
http-status-code-401
cassia
fuzzywuzzy
httpruntime.cache
mobiledoc-kit
iokit
dock
.bash-profile
mod-proxy
vacuum
pyobjc
ms-access-2000
metatrader5
easyrtc
teaspoon
appserver
cbind
raygun
malformedurlexception
gnumeric
mysql-error-2013
asplinkbutton
patricia-trie
iboutlet
azman
lr
http-daemon
timertask
message-passing
addchild
isapi-extension
echo3
complex-event-processing
scrubyt
wysiwym
movieplayer
commercial-application
netbeans6.1

Resources

Encrypt Message