Note that there are some explanatory texts on larger screens.

plurals
  1. POpass string value from one activity to another activity
    primarykey
    data
    text
    <p>Hi I created android app ..It parse values using json. I want to pass this value of json from one activity to another activity. I have created the following code.</p> <p>Activity1....</p> <pre><code>public class WaitressActivity extends Activity { Button btnSearch; Button btnDisplay; Button slide; SimpleSideDrawer slide_me; Button close; RelativeLayout window; ImageView clickWindow; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); initActivity(); clickWindow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent init = new Intent(WaitressActivity.this, TaleActivity.class); init.putExtras("logo",s); startActivity(init); } }); } public void jasonParser() { // Hashmap for ListView //ArrayList&lt;HashMap&lt;String, String&gt;&gt; contactList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); // Creating JSON Parser instance JASONParser jParser = new JASONParser(); // getting JSON string from URL JSONObject json = jParser.getJSONFromUrl(url); try { // Getting Array of Contacts contacts = json.getJSONArray(TAG_RESULT); logo1=new String[contacts.length()]; name1=new String[contacts.length()]; distance1=new String[contacts.length()]; // looping through All Contacts for (int i = 0; i &lt; contacts.length(); i++) { JSONObject c = contacts.getJSONObject(i); logoCount=logoCount+1; // Storing each json item in variable String latitude = c.getString(TAG_LONGITUDE); String lognitute = c.getString(TAG_LATITUDE); storeid = c.getString(TAG_STOREID); storename = c.getString(TAG_STORENAME); logo = c.getString(TAG_LOGO); String city = c.getString(TAG_CITY); distance = c.getString(TAG_DISTANCE); String num = c.getString(TAG_NUM); logo1[i]=logo; name1[i]=storename; distance1[i]=distance; // creating new HashMap // HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); // // // adding each child node to HashMap key =&gt; value // map.put(TAG_LONGITUDE, latitude); // map.put(TAG_LATITUDE, lognitute); // map.put(TAG_STOREID, storeid); // map.put(TAG_STORENAME, storename); // map.put(TAG_LOGO, logo); // map.put(TAG_DISTANCE, distance); // // // // // adding HashList to ArrayList // contactList.add(map); } } catch (JSONException e) { // e.printStackTrace(); } for(int i=0;i&lt;logoCount;i++){ int distanceIntVlue = Integer.parseInt(distance1[i]); if (distanceIntVlue &lt; 200 ) { distanceSecond.setText("Distance meter " + distanceIntVlue); nameSecond.setText(name1[0]); imageLoader.DisplayImage(logo1[0], clickWindow); s=logo1[0]; if(i==1){ int distanceIntVlue1 = Integer.parseInt(distance1[i]); distanceplace.setText("Distance meter " + distanceIntVlue1); name.setText(name1[1]); imageLoaderUp.DisplayImage(logo1[1], logoUp); } if(i==2){ imageLoaderUp.DisplayImage(logo1[2], logoUnder); } } } //tale.showImage(logo);// DownloadAndReadImage dImage = new DownloadAndReadImage(); // // clickWindow.setImageBitmap(dImage.readBitmapImage(logo)); // } public void initActivity() { btnSearch = (Button) findViewById(R.id.btnsearch); btnDisplay = (Button) findViewById(R.id.btndisplay); // Slider=(Button)findViewById(R.id.btnslide); close = (Button) findViewById(R.id.btnclose); window = (RelativeLayout) findViewById(R.id.popup); close.setVisibility(View.INVISIBLE); window.setVisibility(View.INVISIBLE); clickWindow = (ImageView) findViewById(R.id.ImageView01); name = (TextView) findViewById(R.id.name); distanceplace = (TextView) findViewById(R.id.place); nameSecond = (TextView) findViewById(R.id.namesecond); distanceSecond = (TextView) findViewById(R.id.placesecond); logoUp=(ImageView)findViewById(R.id.imageView1); logoUnder=(ImageView)findViewById(R.id.ImageView01); } } </code></pre> <p>my second activity is,</p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tale); // Intent intent = getIntent(); if (null != intent) { urllogo= intent.getStringExtra("StringName"); } </code></pre> <p>but the problem is, parameter "urllogo" always get the null value. I searched and try many ways to do this. but in every time I got null value.. can any one help me thank you..pls...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload