0

My first App

This is my first android app - QR Code Scanner using ZXingScanner Library.

Is there any way to launch a new screen (activity) instead of replacing the crurent one, so i can press back from the scanner to go back to main screen where is the button?

Please help me. Thanks all

Kalista
  • 7
  • 4

2 Answers2

2

I think that this site can help you: http://developer.android.com/training/basics/firstapp/starting-activity.html

In short words: You need to create new

Intent myIntent = new Intent(this, SecondActivity.class) and than start it by startActivity(myIntent).

Additionally it will be good to define your MAIN activity in AndroidManifest.

<activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
0

You should create 2 activities in your app.

From first activity send an intent to the second activity that you created before (I think that you can create one). With sending an intent to another activity the first one remain, and you can use back button to load that.

Now this is the easiest way that you can send an intent:

Intent intent= new Intent(Activity1.this,Activity2.class);
startActivity(intent);

But there is some other ways to send an activity(similar to this one):

How to start new activity on button click

Community
  • 1
  • 1
Good game
  • 84
  • 1
  • 9