locked
Android automatic action run RRS feed

  • Question

  • User308581 posted

    Hi.

    I'm asked that same question before but I want to ask that again.

    @Kuvaaja said: Hi. How can I run Android action automatically without button click (in app) when app is launched?

    If possible, please write code with Java, classes and @Overrides. Because I'm beginner.

    Regards, Teemu

    I mean how to launch my public void called redirecti automatically when my app is launched? Code: public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
    
    public void redirecti(View view) {
        Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.app.package");
        if (launchIntent != null) {
            startActivity(launchIntent);
        }
    }
    

    }

    I don't mean any user with @Override or @Overrides. I am using Android Studio. I know to how to start that with button click but no without button click. Please help me.

    Best regards Kuvaaja or Teemu

    Thursday, April 6, 2017 9:30 AM

All replies

  • User60257 posted

    You can ask, but I don't think you'll get much help here. You are using Android Studio to write Java apps, this is a forum for Xamarin apps built using C# or F# in Visual Studio or Xamarin Studio. So this is not the place to ask.

    Maybe try on Stack Overflow?

    Thursday, April 6, 2017 9:35 AM
  • User308581 posted

    Thanks about the answer. Maybe I try on Stack Overflow. I'm new in Xamarin. Sorry about that question. :(

    Thursday, April 6, 2017 9:43 AM