this is my first question I got stucked in an app development..
I have developed an app. This app has a registration activity in the first stage, here the user's name, password and mobile number is collected and saved in the server. after that, the user's registration process is completed.
once this is done, the app will work to give daily horoscope predictions. This means the app will have to notify, or predict, daily. So after once the registrtion process is over the app should continue to run in the background. Also, when the user re-opens the app, it should not display the registration page, but the prediction page. I would also like a button that closes the app, but keeps it running in background.
How would I go about doing this?
Here is the code to my mainActivity,
public class MainActivity extends Activity
{
Button btn1,btn2;
LoginDataBaseAdapter loginDataBaseAdapter;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
loginDataBaseAdapter=new LoginDataBaseAdapter(this);
loginDataBaseAdapter=loginDataBaseAdapter.open();
btn2 = (Button) findViewById (R.id.button2);
btn1 = (Button) findViewById (R.id.button1);
if(loginDataBaseAdapter.getUsercount() >= 50)
{
btn2.setVisibility(View.INVISIBLE);
}
else
{
btn2.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
// TODO Auto-generated method stub
Intent i = new Intent(MainActivity.this,SignUpActivity.class);
startActivity(i);
}
});
}
btn1.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
// TODO Auto-generated method stub
Intent inte = new Intent(MainActivity.this,SignInActivity.class);
startActivity(inte);
}
});
}
@Override
protected void onDestroy()
{
super.onDestroy();
// Close The Database
loginDataBaseAdapter.close();
}
@Override
public void onBackPressed() {
// TODO Auto-generated method stub
super.onBackPressed();
finish();
}
}