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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:01:01+00:00 2026-05-27T18:01:01+00:00

i have all my students data in s variable i.e first name,last name,id. which

  • 0

i have all my students data in s variable i.e first name,last name,id. which i have retrieved from list view.now i want to retrieve data from s variable to individual string variables like,i want to store first name in one string,last name in another string.like i have done below.but its not working.

i tried to iterate also but its giving error..can any one suggest me some idea of how can i retrieve values from s variable.

public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.thrd);
     Log.i("INFO","ALL DETAILS");
     mydb=new MyDataBase(four.this);
     mydb.openDB();
     lv = (ListView)findViewById(R.id.listView1);  
     save = (Button) findViewById(R.id.button2);

     save.setOnClickListener(new OnClickListener(){
         public void onClick(View arg0) {
             long[] v=  lv.getCheckedItemIds();
             String s1=v.toString();
             int h =lv.getCount();
             for(int i=0;i<lv.getCount();i++) {
                 Object p2  =   lv.getItemAtPosition(i);
                 String s=(String) p2.toString();
                 List<? extends Map<String, ?>> s4=(List<? extends Map<String, ?>>) p2;
                 SimpleAdapter mSchedule1 = new SimpleAdapter(four.this, s4, R.layout.col1,
                         new String[] {"clss","sec","_Sid","FName", "LName"}, new int[] {R.id.editText1, R.id.editText2,R.id.editText3,R.id.editText4,R.id.editText5});
                 lv1.setAdapter(mSchedule1);
                 EditText cls=(EditText)findViewById(R.id.editText1);
                 EditText  sec=(EditText)findViewById(R.id.editText2);
                 EditText  sid=(EditText)findViewById(R.id.editText3);
                 EditText  fname=(EditText)findViewById(R.id.editText4);
                 EditText  lanme=(EditText)findViewById(R.id.editText5);

                 final  String cl=cls.getText().toString();
                 final  String sec1=sec.getText().toString();
                 final  String sid1=sid.getText().toString();
                 final  String fn=fname.getText().toString();
                 final String ln=lanme.getText().toString();
                 final String p="present";

                 Toast.makeText(four.this, sec1, Toast.LENGTH_LONG).show();
             }
         }
     });
     showall=(Button)findViewById(R.id.button1);
     showall.setOnClickListener(new OnClickListener() {
         public void onClick(View v) {
             // TODO Auto-generated method stub
             ArrayList<HashMap<String,String>> p2 = mydb.getAllSDetails();
             SimpleAdapter mSchedule = new SimpleAdapter(four.this, p2, R.layout.column,
                     new String[] {"_Sid","FName", "LName"}, new int[] {R.id.txtfname, R.id.txtlname,R.id.txtage});
             lv.setAdapter(mSchedule);
             lv.setOnItemClickListener(select);
             // int h=   lv.getCount();
         }
     });
}

public OnItemClickListener select=new AdapterView.OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
        int idd[] = mydb.gettingId();
        str = idd[position];
    }
};

my error log

12-29 16:38:51.849: E/AndroidRuntime(561): FATAL EXCEPTION: main
12-29 16:38:51.849: E/AndroidRuntime(561): java.lang.ClassCastException: java.util.HashMap
12-29 16:38:51.849: E/AndroidRuntime(561): at com.android.four$2.onClick(four.java:85)
12-29 16:38:51.849: E/AndroidRuntime(561): at android.view.View.performClick(View.java:2408)
12-29 16:38:51.849: E/AndroidRuntime(561): at android.view.View$PerformClick.run(View.java:8816)
12-29 16:38:51.849: E/AndroidRuntime(561): at android.os.Handler.handleCallback(Handler.java:587)
12-29 16:38:51.849: E/AndroidRuntime(561): at android.os.Handler.dispatchMessage(Handler.java:92)
12-29 16:38:51.849: E/AndroidRuntime(561): at android.os.Looper.loop(Looper.java:123)
12-29 16:38:51.849: E/AndroidRuntime(561): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-29 16:38:51.849: E/AndroidRuntime(561): at java.lang.reflect.Method.invokeNative(Native Method)
12-29 16:38:51.849: E/AndroidRuntime(561): at java.lang.reflect.Method.invoke(Method.java:521)
12-29 16:38:51.849: E/AndroidRuntime(561): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-29 16:38:51.849: E/AndroidRuntime(561): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-29 16:38:51.849: E/AndroidRuntime(561): at dalvik.system.NativeStart.main(Native Method)

  • 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-27T18:01:02+00:00Added an answer on May 27, 2026 at 6:01 pm

    As the question is pretty unclear, don’t know if my answer will be helpful to you, since I’m not sure what you’re asking for exactly. If you’re talking about breaking a String into parts – than you can use the String‘s split(String regex) method. The parameter can be a random delimiter character, for example, a comma. The following code will make a String array from a single String with items delimited by a comma:

    String[] sArray = string.split(",");
    

    Sorry if it’s not what you’ve asked for, but hope this helps.

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

Sidebar

Related Questions

I have data of students from several schools. I want to show a histogram
I have two Entities University courses Course students i want to access all the
i have a table and the content of it is all from data base
I have a jsp that shows me a list of students from base. For
I have got the list of Class Name as Follows: Type[] typelist = typeof(Sample.Students).Assembly.GetTypes();
I have all my views in a project inheriting from a ViewBase class that
I have a program that takes in a data file of students that have
I want to pass two variable at a time from one page to another
I have a data model in Doctrine/symfony. I have a 'Course' which has many
I have the following scenario in zend framework: Data Table of students Table of

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.