Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7971529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:39:32+00:00 2026-06-04T07:39:32+00:00

I start on screen ‘A’. in screen A, I navigate to screen ‘B’ where

  • 0

I start on screen ‘A’. in screen A, I navigate to screen ‘B’ where it change the orientation from portrait to landscape. If I now press the back button it get this exception.

It doesn’t even reach the OnCreate Code

E/AndroidRuntime(518): FATAL EXCEPTION: main    
E/AndroidRuntime(518): java.lang.RuntimeException: Unable to start activity ComponentInfo{be.coenen/be.coenen.TimeregistrationCardActivity}: java.lang.NullPointerException    
E/AndroidRuntime(518):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)    
E/AndroidRuntime(518):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)    
E/AndroidRuntime(518):  at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3815)    
E/AndroidRuntime(518):  at android.app.ActivityThread.access$2400(ActivityThread.java:125)    
E/AndroidRuntime(518):  at android.app.ActivityThread$H.      handleMessage(ActivityThread.java:2037)    
E/AndroidRuntime(518):  at android.os.Handler.dispatchMessage(Handler.java:99)    
E/AndroidRuntime(518):  at android.os.Looper.loop(Looper.java:123)    
E/AndroidRuntime(518):  at android.app.ActivityThread.main(ActivityThread.java:4627)    
E/AndroidRuntime(518):  at java.lang.reflect.Method.invokeNative(Native Method)    
E/AndroidRuntime(518):  at java.lang.reflect.Method.invoke(Method.java:521)    
E/AndroidRuntime(518):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)    
E/AndroidRuntime(518):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)    
E/AndroidRuntime(518):  at dalvik.system.NativeStart.main(Native Method)    
E/AndroidRuntime(518): Caused by: java.lang.NullPointerException    
E/AndroidRuntime(518): at be.coenen.TimeregistrationCardActivity.onCreateDialog(TimeregistrationCardActivity.java:314)    
E/AndroidRuntime(518):  at android.app.Activity.onCreateDialog(Activity.java:2472)    
E/AndroidRuntime(518):  at android.app.Activity.createDialog(Activity.java:881)    
E/AndroidRuntime(518):  at android.app.Activity.restoreManagedDialogs(Activity.java:870)    
E/AndroidRuntime(518):  at android.app.Activity.performRestoreInstanceState(Activity.java:816)    
E/AndroidRuntime(518):  at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1096)    
E/AndroidRuntime(518):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2641)

`
OnCreate screen A:

public class TimeregistrationOverviewActivity extends Activity {
/** Called when the activity is first created. */
private Context context;
private ArrayList<TimeregistrationOverview> listTimeRegOverView;
private TimeregistrationOverviewAdapter listViewAdapter;
private ListView listView;
private String emp, dateTimeRegistration;
private TextView txtDateDisplay;
private Button btnPickDate, btnInterventionRapport;
private int intYear, intMonth, intDay, arrayCount;
private Intent i = new Intent();
final Calendar c = Calendar.getInstance();
final int DATE_DIALOG_ID = 0;

@Override
public void onCreate(Bundle savedInstanceState) {
    try{

    super.onCreate(savedInstanceState);
    context = getApplicationContext();
    setContentView(R.layout.main);


    listView = (ListView) findViewById(R.id.android_TOlist1);
    txtDateDisplay = (TextView) findViewById(R.id.TOdateDisplay);
    btnPickDate = (Button) findViewById(R.id.TObtnDatum);
    btnPickDate.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            showDialog(DATE_DIALOG_ID);
        }
    });

    intYear = c.get(Calendar.YEAR);
    intMonth = c.get(Calendar.MONTH);
    intDay = c.get(Calendar.DAY_OF_MONTH);
    // Get Employee ID
    i = getIntent();
    emp = i.getExtras().getString("Employee");
    if (!(i.getExtras().getString("Date") == null)) {
        dateTimeRegistration = i.getExtras().getString("Date");

    }

    // display the current date
    updateDisplay();

    // gegevens ophalen/updaten
    new DownloadData().execute(LogInActivity.SERVICE_URI
            + "GetTimeregistrationOverview?Date=" + dateTimeRegistration
            + "&Employee=" + emp);
} catch (Exception e) {
    ShowError();
}
}

OnCreate screen B:

public class TimeregistrationCardActivity extends Activity {
/** Called when the activity is first created. */
private TimeregistratrationCard timeRegistrationCard;
private Intent intent = new Intent();
private int id, minute, hour, minuteNow, hourNow;
private TextView date, customerName, description, taskDocNo, activity,
        externalInfo, internalInfo, percentageComplete, project, startTime,
        stopTime;
private CheckBox coaching;
private String employeeNo, dateTimeregistration;
private ProgressDialog m_ProgressDialog;
private Calendar c = Calendar.getInstance();

static final int TIME_DIALOG_ID = 0, TIME_DIALOG_ID2 = 1,
        DATE_DIALOG_ID = 0;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.timeregistrationcard);

    m_ProgressDialog = ProgressDialog.show(
            TimeregistrationCardActivity.this, "", getResources()
                    .getString(R.string.ProgressDialog), true);

    date = (TextView) findViewById(R.id.TRKtxtDatum);
    customerName = (TextView) findViewById(R.id.TRKtxtKlantNaam);
    description = (TextView) findViewById(R.id.TRKtxtDescription);
    taskDocNo = (TextView) findViewById(R.id.TRKtxtTaskDocNo);
    activity = (TextView) findViewById(R.id.TRKtxtActivity);
    coaching = (CheckBox) findViewById(R.id.TRKchkCoaching);
    externalInfo = (TextView) findViewById(R.id.TRKtxtExternalInformation);
    internalInfo = (TextView) findViewById(R.id.TRKtxtInternalInformation);
    percentageComplete = (TextView) findViewById(R.id.TRKtxtPercentageComplete);
    project = (TextView) findViewById(R.id.TRKtxtProject);
    startTime = (TextView) findViewById(R.id.TRKtxtStartTime);
    stopTime = (TextView) findViewById(R.id.TRKtxtStopTime);

    intent = getIntent();
    id = intent.getExtras().getInt("ID");
    employeeNo = intent.getExtras().getString("Emp");
    dateTimeregistration = intent.getExtras().getString("Date");
    new DownloadData().execute(LogInActivity.SERVICE_URI
            + "GetTimeregistrationCard?ID=" + id);

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:39:34+00:00Added an answer on June 4, 2026 at 7:39 am

    Use onConfigurationChanged method in your both activity with below code

    public void onConfigurationChanged(Configuration newConfig) 
    {
        super.onConfigurationChanged(newConfig);
    
        // Checks the orientation of the screen
        if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) 
        {
            Toast.makeText(this, "landscape", Toast.LENGTH_SHORT).show();
        } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT)
        {
            Toast.makeText(this, "portrait", Toast.LENGTH_SHORT).show();
        }
    }
    

    Instead of Toast Just use start the activity to which activity you want to opens. I mean, in Screen A’s onConfigurationChanged method, its changing landscape from portrait means, just start the Screen A instead of Toast there.

    Don’t forgot to add below code in your activity’s manifest file –

    <activity android:name=".your Activity name"  // Your activity name.
          android:configChanges="orientation|keyboardHidden"
          android:label="@string/app_name">
    

    Hope this helps you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I start my application initially, I get a black screen which stays for
So I start a root screen with a file select and a go button.
on Thread 1 get initial start screen then app pauses and all i get
I am wondering how to start a screen session from PHP, I have tried
I have a Screen name DownloaderScreen when the screen start it will start download
The screen which shows whenever i start Netbeans is very annoying, and among the
I start a iPad game using cocos2d.. When I add a full screen image
Example: My Default.png image shows the start screen of my app with an empty
I'm trying to set up a shell script that will start a screen session
I have application with 6 buttons on start screen. My problem is that I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.