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 7443605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:21:22+00:00 2026-05-29T11:21:22+00:00

I am trying to build a small simple program with an image and a

  • 0

I am trying to build a small simple program with an image and a textview under it. Like a countdown. I’ve been trying to runt this program, and everything works except when I get to setText, the program crashes. What could be the problem? I have done a lot of searching and changing, but still get the same problem.

package com.ob.IsIt;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

public class Isit1337 extends Activity {

ImageView image;
TextView t;
String until;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    until = "fnkar inte";
    t=(TextView)findViewById(R.layout.main);
    run();





}
private void run()
{

    if(IsIt.check())
    {

        image.setEnabled(false);

    }

    until = IsIt.timeLeft();

    t.setText("test");


    }
}

The IsIt works, the IsIt.check returns a boolean and the IsIt.timeLeft returns a String.
The xml code looks like this.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="bottom|center|center_vertical|top"
android:orientation="vertical" >

<ImageView
    android:id="@+id/image"
    android:layout_width="277dp"
    android:layout_height="441dp"
    android:src="@drawable/blackno" />

<TextView
    android:id="@+id/t"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="0.46"
    android:textAppearance="?android:attr/textAppearanceLarge" />

</LinearLayout>

Thank you in advance!

  • 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-05-29T11:21:23+00:00Added an answer on May 29, 2026 at 11:21 am

    I’m guessing that you’re getting a NullPointerException. (When asking this kind of question, it’s better to also paste the relevant LogCat output.) Change this line:

    t=(TextView)findViewById(R.layout.main);
    

    to this:

    t=(TextView)findViewById(R.id.t);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to build this small java app. I find it very difficult
I'm trying to build a small program that hosts vst effects and I would
I'm trying to build a simple echo server/client that works on ethernet level(using raw
I've been going at this, literally for days. I'm trying to build FFmpeg with
What I'm trying to do: build a super simple button skin (say a small
I'm trying to build a really simple php controller page for a small site.
I'm trying to build a small code that works across multiple platforms and compilers.
I am trying to build simple and small preemptive OS for the ARM processor
I get the following errors when trying to build a small and simple project
I'm trying to build a small language with similar syntax and grammatical structure to

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.