how to pass Json data in Android Adapter

Harian Manda

Hello I am trying to pass Json Data from Adapter to another Activity

 playb = (ImageButton) row.findViewById(R.id.playbtn);
   playb.setOnClickListener(new View.OnClickListener() {
       @Override
       public void onClick(View v) {
          //  Song newitem = getItem(position);
           //long itemId = getItemId(position);
            app = (myapplication) getContext().getApplicationContext();
            app.setSong(item);
           Intent intent1 = new Intent(getContext(), SongDetailedActivity.class);

             intent1.putExtra("SongID", item.toString());
           getContext().startActivity(intent1);
       }
   });

and my activity

 Intent i = getActivity().getIntent();
        hello = i.getIntExtra("SongID", 5);
        Song event = app.getSongID(hello);
        event.setSongID(hello);
Ravi Teja

In your activity,

Bundle bundle = getIntent().getExtras();
if(bundle != null && bundle.containsKey("SongID")){
  String json = bundle.getString("SongID");
  JSONObject jsonObject = new JSONObject(json);
  //parse json from here...don't forget to handle JSONException
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to pass an ArrayList filled with JSON data to a constructor for RecyclerView Adapter?

From Dev

How to pass value and get json data in android?

From Dev

How to pass data from a fragment to an adapter

From Dev

How to pass a string value to adapter class (Base adapter) android JAVA

From Dev

How to pass JSON data from MVC4 to Flot without writing an adapter

From Dev

How to create Custom spinner adapter with JSON Data?

From Dev

How to Pass String Array from RecyclerView Adapter to Fragment in Android

From Dev

How to pass json array object from one javascript adapter to another javascript adapter?

From Dev

Cannot add new data from JSON to adapter of Listview in Android

From Dev

Pass by Value and Pass by Reference in Android Adapter?

From Dev

How to pass an argument to a Custom Adapter?

From Dev

How to customize an adapter in Android?

From Dev

SQLite get all data and pass it to an Adapter

From Dev

Pass the data from Recyclerview adapter to Fragment

From Dev

How to pass JSON data to AngularJS directive

From Dev

How to pass json data to highcharts series?

From Dev

How to pass a set of json data in javascript function?

From Dev

How to pass json data to .js files

From Dev

How to pass a set of json data in javascript function?

From Dev

how to pass json data to controller in aspnetcore 2

From Dev

Android data binding with custom adapter

From Dev

how to pass data using bundle in android?

From Dev

How to pass data between multiple Fragments in Android

From Dev

how to pass data intent in different textview in android

From Dev

How to pass data from fragment to another - android

From Dev

How to pass data from Android to Laravel

From Dev

How to pass the data correctly inside a ViewPager in Android

From Dev

How to retrieve data from Image Adapter when a particular item is clicked in a grid view and pass it to another activity?

From Dev

How to get data from custom list view adapter and pass to intent put extra?

Related Related

  1. 1

    How to pass an ArrayList filled with JSON data to a constructor for RecyclerView Adapter?

  2. 2

    How to pass value and get json data in android?

  3. 3

    How to pass data from a fragment to an adapter

  4. 4

    How to pass a string value to adapter class (Base adapter) android JAVA

  5. 5

    How to pass JSON data from MVC4 to Flot without writing an adapter

  6. 6

    How to create Custom spinner adapter with JSON Data?

  7. 7

    How to Pass String Array from RecyclerView Adapter to Fragment in Android

  8. 8

    How to pass json array object from one javascript adapter to another javascript adapter?

  9. 9

    Cannot add new data from JSON to adapter of Listview in Android

  10. 10

    Pass by Value and Pass by Reference in Android Adapter?

  11. 11

    How to pass an argument to a Custom Adapter?

  12. 12

    How to customize an adapter in Android?

  13. 13

    SQLite get all data and pass it to an Adapter

  14. 14

    Pass the data from Recyclerview adapter to Fragment

  15. 15

    How to pass JSON data to AngularJS directive

  16. 16

    How to pass json data to highcharts series?

  17. 17

    How to pass a set of json data in javascript function?

  18. 18

    How to pass json data to .js files

  19. 19

    How to pass a set of json data in javascript function?

  20. 20

    how to pass json data to controller in aspnetcore 2

  21. 21

    Android data binding with custom adapter

  22. 22

    how to pass data using bundle in android?

  23. 23

    How to pass data between multiple Fragments in Android

  24. 24

    how to pass data intent in different textview in android

  25. 25

    How to pass data from fragment to another - android

  26. 26

    How to pass data from Android to Laravel

  27. 27

    How to pass the data correctly inside a ViewPager in Android

  28. 28

    How to retrieve data from Image Adapter when a particular item is clicked in a grid view and pass it to another activity?

  29. 29

    How to get data from custom list view adapter and pass to intent put extra?

HotTag

Archive