How to display Android database data in a ListView?

Is it possible to communicate between different classes in same package?

  • Im developing an android app, in that I want to share a value in one Activities with another.But I dont know to do. Ex. My getting email and password in my first activity , by pressing login button in that activity , I have to go to another activity , in that activity I have to display the details of that particular by retriving data from database...How can I do?

  • Answer:

    Okay, do the following. Suppose you want to send String myUsername and String myPassword from MyFirstActivity to MySecondActivity. 1. Drag and drop a Button in your layout 2. Put an onClickListener on the Button like this: Button myButton; myButton = (Button)findViewById(R.id.button1); myButton.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub } }); 3. Inside the onClick method, put this: Intent myIntent = new Intent(MyFirstActivity.this, MySecondActivity.class); i.putExtra("Username", myUsername); i.putExtra("Password", myPassword); startActivity(i); 4. On MySecondActivity, get those Strings: Intent i = getIntent(); String myForwardedUsername = i.getStringExtra("Username"); String myForwardedPassword = i.getStringExtra("Password");

Satish Yadav at Quora Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.