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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:34:53+00:00 2026-06-05T23:34:53+00:00

Good day, I try to start new Activity from another. But it always crashed.

  • 0

Good day, I try to start new Activity from another. But it always crashed.
Here My code. It is the event on ListView.

list.setOnItemClickListener(new OnItemClickListener(){
            public void onItemClick(AdapterView<?> parent, View view, int position, long id){
                Student selected = (Student)list.getItemAtPosition(position);
                String selectedTitle = selected.FirstName;  //ideally this would probably be done with accessors
                int selectedId = selected.studentId;
                String selectedDescription = selected.LastName;

               Intent i = new Intent(view.getContext(), StudentInfoActivity.class);
               i.putExtra("studentId", selectedId);
               try{
                   startActivity(i);
               }catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }

            }
        });

A added an activity to Manifest

<activity
            android:name=".StudentInfoActivity"
            android:label="@string/app_name" >
        </activity>

An error message is

06-15 17:17:00.471: E/AndroidRuntime(602): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.marat.mutw/com.marat.mutw.StudentInfoActivity}: java.lang.NullPointerException: uriString

All previus activities, those I added works fine…

StudentInfoActivity

public class StudentInfoActivity extends Activity {

    ImageView image;
    TextView firstLastName;
    TextView studentInfo;
    TextView addInfo;
    Student std;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.sudentinfolayout);

        image = (ImageView)findViewById(R.id.avatar);
        firstLastName = (TextView)findViewById(R.id.firstNameLastName);
        studentInfo = (TextView)findViewById(R.id.studentinfo);
        addInfo = (TextView)findViewById(R.id.description);

        int studentId = getIntent().getExtras().getInt("studentId");
        JSONHandler handler = new JSONHandler(this.getApplicationContext());
        std = new Student();
        std = handler.GetStudentInfo(studentId);
        image.setImageURI(Uri.parse(std.imagePath));
        firstLastName.setText(std.FirstName+ "  "+std.LastName);




    }
    public void onClickApply(View view){

    }

}
  • 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-05T23:34:55+00:00Added an answer on June 5, 2026 at 11:34 pm

    instead of

    Intent i = new Intent(view.getContext(), StudentInfoActivity.class);
    

    change to

    Create static object of that activity 
    

    e.g Activity actOne =null;

    public static actOne a ;
    a = this;
    
    Intent i = new Intent(a, StudentInfoActivity.class);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good day. I try to add event to segment control, but it always take
Good day. When i try to run the example from MSDN. But it failed
Good day, I have an activity which i navigate to from an icon on
Good day, i will try and explain myself here. i am trying to create
Good day. I try to add new tab with navigation controller to my app.
Good day, I receive data from a communication channel and display it. Parallel, I
Good day everyone. I have an audio class, that plays a .wav file. But
Good day, i will try to explain my problem as best as i can.
Good day, I've read a few other stack overflow postings and other tutorials, but
Good day. I try to use jqGrid in my web project. everything is good

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.