update ui from background service in android using Broadcast Receiver.

The first thing that needs to be done is to create a string called BROADCAST_ACTION, this is simply a string that identifies what kind of action is taking place. Most of the time, it’s common to use the package name with the kind of action added to the end, so we’ll do that here. The next step is to create a handler that will be used to broadcast our data every 5 seconds. It’s better to use a Timer instead of Handler.

In onCreate, I’ve created a Intent and passed the BROADCAST_ACTION to the constructor of the intent. Notice that the Intent was defined as a global variable above. The intent will be called repeatedly in the Timer below and there is no reason to create a new intent every 5 seconds, so I’ll create it once here.

MainActivity.Java

public class MainActivity extends AppCompatActivity {
    TextView textview;
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        textview=(TextView)findViewById(R.id.textview);
    }
    @Override
    protected void onStart() {
        super.onStart();

        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(MyService.MY_ACTION);
        registerReceiver(broadcastReceiver, intentFilter);
        //Start our own service
        Intent intent = new Intent(MainActivity.this,
                com.apps.broadcastrapp.MyService.class);
        startService(intent);
        super.onStart();
    }
    /*@Override
    protected void onStop() {
        // TODO Auto-generated method stub
        unregisterReceiver(myReceiver);
        super.onStop();
    }*/
    BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            int datapassed = intent.getIntExtra("DATAPASSED", 0);
            String s = intent.getAction().toString();
            String s1 = intent.getStringExtra("DATAPASSED");
            textview.setText(s1);
            Toast.makeText(context,
                    "Triggered by Service!\n"
                            + "Data passed: " + String.valueOf(s1),
                    Toast.LENGTH_LONG).show();
        }
    };
}

MyService.java class

public class MyService extends Service {

    final static String MY_ACTION = "MY_ACTION";
    private static Context context;
    private Timer timer;
    public  String Data;

    @Override
    public IBinder onBind(Intent arg0) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        // TODO Auto-generated method stub

        MyThread myThread = new MyThread();
        myThread.start();

        return super.onStartCommand(intent, flags, startId);
    }

    public class MyThread extends Thread{

        @Override
        public void run() {
            // TODO Auto-generated method stub

            try {
                int delay = 1000; // delay for 1 sec.
                int period = 12 * 1000; // repeat every 120 sec.
                timer = new Timer();
                timer.scheduleAtFixedRate(new TimerTask() {
                    public void run() {
                        Calendar c = Calendar.getInstance();
                        Data = String.valueOf((c.get(Calendar.MILLISECOND)));
                        Intent intent = new Intent();
                        intent.setAction(MY_ACTION);
                        intent.putExtra("DATAPASSED", Data);
                        sendBroadcast(intent);
                    }
                }, delay, period);
            } catch (Exception ex) {
                ex.printStackTrace();
            }
            stopSelf();
        }

    }

}

Android Upload Image using Android Upload Service Using Volley.

1.Create XML View it Contains 2 button upload & Choose an Image view to set 
  selected image to image view an after that upload button to upload on server.

 
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="15dp"
    android:paddingLeft="15dp"
    android:paddingRight="15dp"
    android:paddingTop="15dp"
    android:orientation="vertical">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:id="@+id/image"/>

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Choose"
        android:id="@+id/choose"/>

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Upload"
        android:id="@+id/upload"/>

</LinearLayout>

How It Works?

Image to Base64 String

  • First convert the image into bitmap.
  • Then compress bitmap to ByteArrayOutputStream.
  • Convert ByteArrayOutputStream to byte array.
  • Finally convert byte array to base64 string.

Base64 String to Image

  • Convert the base64 string to byte array.
  • Now convert byte array to bitmap
  • 2)Java file for XML biniding.
  • public class MainActivity extends AppCompatActivity {
    
        Button choose,upload;
        ImageView image;
        int PICK_IMAGE_REQUEST = 111;
        String URL ="Your API";
        Bitmap bitmap;
        ProgressDialog progressDialog;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            choose=(Button)findViewById(R.id.choose);
            upload=(Button)findViewById(R.id.upload);
            image=(ImageView)findViewById(R.id.image);
            choose.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent = new Intent();
                    intent.setType("image/*");
                    intent.setAction(Intent.ACTION_PICK);
                    startActivityForResult(Intent.createChooser(intent, "Select Image"), PICK_IMAGE_REQUEST);
                }
            });
            upload.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                sendImageToServer();
                }
            });
    
        }
    
        private void sendImageToServer()
        {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
            byte[] imageBytes = baos.toByteArray();
            final String imageString = Base64.encodeToString(imageBytes, Base64.DEFAULT);
    
            StringRequest stringRequest = new StringRequest(Request.Method.POST, URL,
                    new Response.Listener<String>() {
                        @Override
                        public void onResponse(String response)
                        {
                            getJsonResponse(response);
                            //  Toast.makeText(ReaderActivity.this, response, Toast.LENGTH_LONG).show();
                            System.out.println("RESPONSE"+response);
                        }
                    },
                    new Response.ErrorListener() {
                        @Override
                        public void onErrorResponse(VolleyError error)
                        {
                            Toast.makeText(MainActivity.this, error.toString(), Toast.LENGTH_LONG).show();
                        }
                    }) {
                @Override
                protected Map<String, String> getParams()
                {
                    Map<String, String> params = new HashMap<String, String>();
                    params.put("Comment", "Report");
                    params.put("FileName",imageString);
                    params.put("FileType", "Profile");
                    params.put("ReportType","IncidentType");
                    params.put("SenderId","57");
                    return params;
                }
            };
    
            RequestQueue requestQueue = Volley.newRequestQueue(this);
            requestQueue.add(stringRequest);
        }
    
        private void getJsonResponse(String response)
        {
            try {
                JSONArray jsonArray = new JSONArray(response);
                String resultCode = jsonArray.getJSONObject(0).getString("ResultCode");
                if(resultCode.equals("OK"))
                {
    
                    Toast.makeText(this, "Image Uploaded Successfully....!!!!", Toast.LENGTH_SHORT).show();
                }else
                {
                    Toast.makeText(this, "Please try Again.....!!!!", Toast.LENGTH_SHORT).show();
    
                }
    
    
            }
    
            catch (JSONException e)
            {
                e.printStackTrace();
            }
    
        }
    
    
        @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data)
        {
            super.onActivityResult(requestCode, resultCode, data);
            if (requestCode == PICK_IMAGE_REQUEST && resultCode == RESULT_OK && data != null && data.getData() != null) {
                Uri filePath = data.getData();
                try {
                    //getting image from gallery
                    bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), filePath);
                    //Setting image to ImageView
                    image.setImageBitmap(bitmap);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    }

How to Prase Response According to the Key.

try {
    JSONArray jsonArray = new JSONArray(response);
    String resultCode = jsonArray.getJSONObject(0).getString("ResultCode");
    if(resultCode.equals("OK"))
    {
        Toast.makeText(this, "Attendance Marked Successfully", Toast.LENGTH_SHORT).show();
    }else if(resultCode.equals("Error"))
    {
        String strErrorMessage = jsonArray.getJSONObject(0).getString("Message");
        Toast.makeText(this, strErrorMessage, Toast.LENGTH_SHORT).show();

    }


}

catch (JSONException e)
{
    e.printStackTrace();
}

Posting Data on server Using Volley Android This Tutorial let us know how to post data using volley. Here i will be calling a POST service which will accept parameters and returns a json result . This is method we will be using to add parameters which we want to send to server.

  try {

                        StringRequest stringRequest = new StringRequest(Request.Method.POST, Scan_URL,
                                new Response.Listener<String>() {
                                    @Override
                                    public void onResponse(String response) {
                                        getJsonResponse(response);
                                        System.out.println("RESPONSE" + response);
                                    }
                                },
                                new Response.ErrorListener() {
                                    @Override
                                    public void onErrorResponse(VolleyError error)
                                    {
                                        Toast.makeText(QRScan_Activity.this, error.toString(), Toast.LENGTH_LONG).show();
                                    }
                                }) {
                            @Override
                            protected Map<String, String> getParams()
                            {

                                Map<String, String> params = new HashMap<String, String>();
                                params.put("UserID", strUserId);
                                params.put("UserQRCode", Data);
                                params.put("QRLAt",sessionManager.getCurrentLat());
                                params.put("QRLong",sessionManager.getCurrentLong());

                    return params;
                            }
                        };

                        RequestQueue requestQueue = Volley.newRequestQueue(this);
                        requestQueue.add(stringRequest);


                    } catch (Exception e) {
                        e.printStackTrace();
                    }

TUTORIAL ON CUSTOM LISTVIEW USING VOLLEY IN ANDROID STUDIO.

Agenda:-

1.      What is Volley Library?

2.     What is JSON?

3.     What is Custom ListView?

4.     Build Simple APP Using Volley Library, JSON, and Custom ListView.

So let’s start.

1: What is Volley?

  • Volley is a networking library developed by Google and introduced during Google I/O 2013 networking class capable of working without user interfering.
  • Until the release of Volley, the Apache and canonical Java class java.net.HttpURLConnection were the only available tools for the communication between a client with the backend.

Why Volley?

  • Avoid HttpUrlConnection and HttpClient.
  • Avoid AsyncTask, too.
  • It’s much faster.
  • Small Metadata operations.

Using Volley

  • Volley mostly works with just two classes, RequestQueue and Request. First, you have to create a RequestQueue, which manages worker threads and delivers the parsed results back to the main thread. You then pass it one or more Request objects.
  • When you create an object of Request class, it will take four parameters: the method type (GET, POST, etc.), the URL of the resource, and event listeners. Then, depending on the type of request, it may ask for some more variables.

Importing Volley

Download the Volley source from its repository. If you feel confident doing this, this Git command can do all the work for you:

https://android.googlesource.com/platform/frameworks/volley

There is another way as well; Add following line in the dependency of the build.gradle:

compile 'com.android.volley:volley:1.0.0'

2. Go to AndroidManifest.xml to Add Internet Access to Your App:

  • As we are fetching our JSON data from a URL, we need to have internet access permission in our application.
<uses-permission android:name=”android.permission.INTERNET”/>

3. Edit your MainActivity.xml file.

  • Go to Android/res/layout/MainActivity.xml. (My file name is activity_main.xml)
  • Add a relative layout and a list view, either drag and drop or by XML code
  • Below is the XML code. (Your code should look similar to this).
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"><ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:dividerHeight="1dp"
android:background="#ef2505"/>
</RelativeLayout>

4. Create Another XML File for Showing Data.

  • Now you need to add listview row XML file where we will show data.
  • Go to layout-> right click go to New-> add Layout Resource File-> name your XML file and click ok.
  • Add 4 TextViews and 1 NetworkImageView within RelativeLayout.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:padding="8dp"
    android:background="#cf7f7f"
    >

    <com.android.volley.toolbox.NetworkImageView
        android:id="@+id/thumbnail"
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:layout_alignParentLeft="true"
        android:layout_marginRight="8dp" />

    <TextView
        android:id="@+id/name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/thumbnail"
        android:layout_toRightOf="@+id/thumbnail"
        android:textSize="15dp"
        android:textColor="#575294"
        android:textStyle="bold"
        android:fontFamily="sans-serif-condensed"
        />

    <TextView
        android:id="@+id/worth"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/name"
        android:layout_marginTop="1dip"
        android:layout_toRightOf="@+id/thumbnail"
        android:textSize="15dp"
        android:textColor="#575294"
        android:fontFamily="sans-serif-condensed"

        />

    <TextView
        android:id="@+id/source"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/worth"
        android:layout_marginTop="5dp"
        android:layout_toRightOf="@+id/thumbnail"
        android:textSize="15dp"
        android:textColor="#575294"
        android:fontFamily="sans-serif-condensed"

        />

    <TextView
        android:id="@+id/inYear"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:textSize="15dp"
        android:textColor="#f9f9f9"
        android:fontFamily="sans-serif-condensed"

        />

</RelativeLayout>

5.  Go to MainActivity.java file:

  • This class contains JsonArrayRequest with their attributes.
  • In this class, we are parsing data from URL.

Here, I am using above JSON’s link as example.

package volleylistview.com.volleylistview;

import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;
import android.widget.ListView;

import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonArrayRequest;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
* Created by Ganesh Divekar on 11/07/2016.
*/

public class MainActivity extends Activity {

private static final String tag = MainActivity.class.getSimpleName();
private static final String url = "https://raw.githubusercontent.com/iCodersLab/Custom-ListView-Using-Volley/master/richman.json";
private List<DataSet> list = new ArrayList<DataSet>();
private ListView listView;
private Adapter adapter;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

listView = (ListView) findViewById(R.id.list);
adapter = new Adapter(this, list);
listView.setAdapter(adapter);


JsonArrayRequest jsonreq = new JsonArrayRequest(url,
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {

for (int i = 0; i < response.length(); i++) {
try {

JSONObject obj = response.getJSONObject(i);
DataSet dataSet = new DataSet();
dataSet.setName(obj.getString("name"));
dataSet.setImage(obj.getString("image"));
dataSet.setWorth(obj.getString("worth"));
dataSet.setYear(obj.getInt("InYear"));
dataSet.setSource(obj.getString("source"));
list.add(dataSet);
} catch (JSONException e) {
e.printStackTrace();
}

}
adapter.notifyDataSetChanged();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
AlertDialog.Builder add = new AlertDialog.Builder(MainActivity.this);
add.setMessage(error.getMessage()).setCancelable(true);
AlertDialog alert = add.create();
alert.setTitle("Error!!!");
alert.show();
}
});
Controller.getPermission().addToRequestQueue(jsonreq);
}

}

Description of code:

  • We created an object of Adapter class which is used to add data on.
  • We have created the object of JsonObjectRequest and also passed the parameter in the JsonObjectRequest class.
  • Now I will tell you one by one how and why we passed each parameter.
  • The first parameter is URL from where we want to parse our data.
  • The second parameter is Listener. Here we have passed the Response. A listener which will override the method onResponse() and passed JSONObject as a parameter. onResponse()method take the response from the JSON data requested by a user.
  • Here we are using for loop to get the JSON Objects from JSON Array. This for loop works until all the JSON objects are parsed.
  • We are creating the object of JSONObject() class . This will get the each object from the JSON array continuously.
  • Here we created the object of DataSet class which is user built in class.
  • Here we are retrieving the data from JsonArray using JsonObject and passing it to a method which is basically in DataSet class.
  • The third and the last parameter is ErrorListener . The Response.ErrorListener which will override the method onErrorResponse() and gives the VolleyError variable for any Exception. onErrorResponse() method handle the error occurs due to volley library.
  • To send a request, add JsonRequest object to the requestQueuewith add().
  • Once you add the request it moves through the pipeline, gets serviced, and has its raw response parsed and delivered.

 

6. Create DataSet.java file.

  • This class holds object after parsing to provide data to ListView.
package volleylistview.com.volleylistview;


/**
* Created by Ganesh Divekar on 11/07/2016.
*/

public class DataSet {

private String name, image;
private int year;
private String source;
private String worth;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getImage() {
return image;
}

public void setImage(String image) {
this.image = image;
}

public int getYear() {
return year;
}

public void setYear(int year) {
this.year = year;
}

public String getSource() {
return source;
}

public void setSource(String source) {
this.source = source;
}

public String getWorth() {
return worth;
}

public void setWorth(String worth) {
this.worth = worth;
}
}

Description of code:

“This class is straightforward to understand, so I am not going to describe this class because you already know about methods in java so let’s skip description and move on another part of App.”

 

7. Create Adapter.java file.

  •  This class contains adapter for our listview and will show our data.
  •  It is custom list adapter which renders each row of ListView, getView method is called for each row, which uses list_row.xml as view and fills it with the appropriate data.
package volleylistview.com.volleylistview;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.NetworkImageView;

import java.util.List;


/**
* Created by Ganesh Divekar on 11/07/2016.
*/

public class Adapter extends BaseAdapter {

private Activity activity;
private LayoutInflater inflater;
private List<DataSet> DataList;
ImageLoader imageLoader = Controller.getPermission().getImageLoader();

public Adapter(Activity activity, List<DataSet> dataitem) {
this.activity = activity;
this.DataList = dataitem;
}

@Override
public int getCount() {
return DataList.size();
}

@Override
public Object getItem(int location) {
return DataList.get(location);
}

@Override
public long getItemId(int position) {
return position;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {

if (inflater == null)
inflater = (LayoutInflater) activity
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (convertView == null)
convertView = inflater.inflate(R.layout.list_row, null);

if (imageLoader == null)
imageLoader = Controller.getPermission().getImageLoader();
NetworkImageView thumbNail = (NetworkImageView) convertView
.findViewById(R.id.thumbnail);
TextView name = (TextView) convertView.findViewById(R.id.name);
TextView worth = (TextView) convertView.findViewById(R.id.worth);
TextView source = (TextView) convertView.findViewById(R.id.source);
TextView year = (TextView) convertView.findViewById(R.id.inYear);
DataSet m = DataList.get(position);
thumbNail.setImageUrl(m.getImage(), imageLoader);
name.setText(m.getName());
source.setText("Wealth Source: " + String.valueOf(m.getSource()));
worth.setText(String.valueOf(m.getWorth()));
year.setText(String.valueOf(m.getYear()));

return convertView;
}

}

  

Description of code:

  • In our GetView method, we are using ImageLoader’s object for checking if permission is granted or not.
  • We created an object of NetworkImageCiew which is basically Volley’s tool and TextView’s object, too.
  • Then we set all the data on different TextViews.

8.  Create Controller.java File.

  • This class controller our request and control our app.
package volleylistview.com.volleylistview;

import android.app.Application;
import android.text.TextUtils;

import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.Volley;


/**
* Created by Ganesh Divekar on 11/07/2016.
*/

public class Controller extends Application {

public static final String TAG = Controller.class.getSimpleName();

private RequestQueue queue;
private ImageLoader ImageLoader;

private static Controller controller;

@Override
public void onCreate() {
super.onCreate();
controller = this;
}

public static synchronized Controller getPermission() {
return controller;
}

public RequestQueue getRequestQueue() {
if (queue == null) {
queue = Volley.newRequestQueue(getApplicationContext());
}

return queue;
}

public ImageLoader getImageLoader() {
getRequestQueue();
if (ImageLoader == null) {
ImageLoader = new ImageLoader(this.queue,
new BitmapCache());
}
return this.ImageLoader;
}

public <T> void addToRequestQueue(Request<T> req, String tag) {
// set the default tag if tag is empty
req.setTag(TextUtils.isEmpty(tag) ? TAG : tag);
getRequestQueue().add(req);
}

public <T> void addToRequestQueue(Request<T> req) {
req.setTag(TAG);
getRequestQueue().add(req);
}

public void cancelPendingRequests(Object tag) {
if (queue != null) {
queue.cancelAll(tag);
}
}

}

Description of code:

  • Here we created RequestQueue class object which is basically Volley’s main class ,I already gave the description of this class above.
  • Here we created ImageLoader class object which is basically Volley’s main class, I already gave the description of this class above.
  • Here we created Controller class instance.
  • We created method getRequestQueue() to get a request from the web server.

Finally.

9. Create BitmapCache.java File:

  • Now we are going to do the main coding for our application.
  • This file takes care of caching the image on disk.

v

package volleylistview.com.volleylistview;

import android.graphics.Bitmap;
import android.support.v4.util.LruCache;

import com.android.volley.toolbox.ImageLoader;


/**
 * Created by Ganesh Divekar on 11/07/2016.
 */

public class BitmapCache extends LruCache<String, Bitmap> implements
        ImageLoader.ImageCache {

    public static int getDefaultLruCacheSize() {
        final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
        final int cacheSize = maxMemory / 8;

        return cacheSize;
    }

    public BitmapCache() {
        this(getDefaultLruCacheSize());
    }

    public BitmapCache(int sizeInKiloBytes) {
        super(sizeInKiloBytes);
    }

    @Override
    protected int sizeOf(String key, Bitmap value) {
        return value.getRowBytes() * value.getHeight() / 1024;
    }

    @Override
    public Bitmap getBitmap(String url) {
        return get(url);
    }

    @Override
    public void putBitmap(String url, Bitmap bitmap) {
        put(url, bitmap);
    }
}
Get Postion Using OnItemClickListener:
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
 Intent intent = new Intent(MainActivity.this,
 NewsDetailsActivity.class);
 DataSet data = new DataSet();
 System.out.println("aaaaa"+data.getWorth());
 DataSet m = list.get(position);

 System.out.println("YES"+m.getName());
 intent.putExtra("NewsBigHeading", m.getName());
 startActivity(intent);
 }
});


How to send Data from Next Activity getposition Data:
Bundle bundle = getIntent().getExtras();
String name =  bundle.getString("NewsBigHeading");