Your Perfect Assignment is Just a Click Away
We Write Custom Academic Papers

100% Original, Plagiarism Free, Customized to your instructions!

glass
pen
clip
papers
heaphones

Android Studio – Java

Android Studio – Java

Android Studio (Java)

Modify the Networking app (code given below):

Load a webpage that has at least two images

Analyze the text received and find the component

Analyze the html page received and fetch every images referenced by the page
Store the fetched images in a Bitmap array

Display the thumbnail images in a GridView

On touching each thumbnail in the GridView, display the full image

PLEASE INCLUDE ALL MODIFIED AS WELL AS ADDITIONAL FILES USED IN IMPLEMENTATION
PLEASE ALSO INCLUDE SCREENSHOTS OF THE OUTPUT

Current Networking App Output:

First add in AndroidManifest.xml
activity_main.xml
xmlns_app=”http://schemas.android.com/apk/res-auto”
xmlns_tools=”http://schemas.android.com/tools”
android_layout_width=”match_parent”
android_layout_height=”match_parent”
android_id=”@+id/activity_main”
tools_context=”com.wenbing.networking.MainActivity”>

  android_src=”@color/material_grey_300″
  android_layout_width=”209dp”
  android_layout_height=”272dp”
  android_id=”@+id/imageView”
  app_layout_constraintLeft_toLeftOf=”@+id/activity_main”
  app_layout_constraintTop_toTopOf=”@+id/activity_main”
  app_layout_constraintRight_toRightOf=”@+id/activity_main”
  app_layout_constraintBottom_toBottomOf=”@+id/activity_main” />
MainActivity.java
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import android.Manifest;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.widget.ImageView;
import android.widget.Toast;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import java.io.InputStreamReader;
public class MainActivity extends AppCompatActivity {
ImageView img;
final private int REQUEST_INTERNET = 123;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

if (ContextCompat.checkSelfPermission(this, Manifest.permission.INTERNET)
   != PackageManager.PERMISSION_GRANTED) {
  ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.INTERNET}, REQUEST_INTERNET);
  } else{
  downloadSomething();
  }
}
private void downloadSomething() {
String texturl = “http://academic.csuohio.edu/zhao_w/”;
String imgurl = “http://2.bp.blogspot.com/-us_u2PBLSOI/UqgPMh7ovjI/AAAAAAAACdI/ujdyGregs6Y/s1600/amazing-butterfly-hd-image.jpg”;

new DownloadImageTask().execute(imgurl);
new DownloadTextTask().execute(texturl);
}

@Override
public void onRequestPermissionsResult(int requestCode,
       String[] permissions, int[] grantResults) {
switch (requestCode) {
case REQUEST_INTERNET:
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
   downloadSomething();
  } else {
   Toast.makeText(MainActivity.this,
“Permission Denied”, Toast.LENGTH_SHORT).show();
  }
break;
default:
super.onRequestPermissionsResult(requestCode,
    permissions, grantResults);
}
}
private InputStream OpenHttpConnection(String urlString) throws IOException
{
InputStream in = null;int response = -1; URL url = new URL(urlString);
URLConnection conn = url.openConnection();
if (!(conn instanceof HttpURLConnection))
throw new IOException(“Not an HTTP connection”);
try{
  HttpURLConnection httpConn = (HttpURLConnection) conn;
  httpConn.setAllowUserInteraction(false);
  httpConn.setInstanceFollowRedirects(true);
  httpConn.setRequestMethod(“GET”);
  httpConn.connect();
  response = httpConn.getResponseCode();
if (response == HttpURLConnection.HTTP_OK) {
  in = httpConn.getInputStream();
  }
} catch (Exception ex)
{
  Log.d(“Networking”, ex.getLocalizedMessage()); throw new IOException(“Error connecting”);
}
return in;
}

private InputStream download(String URL) {
InputStream in = null;
try {
  in = OpenHttpConnection(URL);
return in;
} catch (IOException e1) {
  Log.d(“NetworkingActivity”, e1.getLocalizedMessage());
}
return null;
}
private Bitmap DownloadImage(String URL)
{
Bitmap bitmap = null;
InputStream in = download(URL);
if(in != null) {
  bitmap = BitmapFactory.decodeStream(in);
try {
  in.close();
  } catch (IOException e1) {
  Log.d(“NetworkingActivity”, e1.getLocalizedMessage());
  }
}
return bitmap;
}
private class DownloadImageTask extends AsyncTask {
protected Bitmap doInBackground(String… urls) {
return DownloadImage(urls[0]);
}
protected void onPostExecute(Bitmap result) {
  ImageView img = (ImageView) findViewById(R.id.imageView);
  img.setImageBitmap(result);
}
}
private String DownloadText(String URL)
{
int BUFFER_SIZE = 2000;
  InputStream in = download(URL);
  InputStreamReader isr = new InputStreamReader(in);
int charRead;
  String str = “”;
char[] inputBuffer = new char[BUFFER_SIZE];
try {
while ((charRead = isr.read(inputBuffer))>0) {
   String readString = String.copyValueOf(inputBuffer, 0, charRead);
   str += readString;
   inputBuffer = new char[BUFFER_SIZE];
  }
  in.close();
  } catch (IOException e) {
  Log.d(“Networking”, e.getLocalizedMessage());
return “”;
  }
return str;
}
private class DownloadTextTask extends AsyncTask {
protected String doInBackground(String… urls) {
return DownloadText(urls[0]);
  }
  @Override
protected void onPostExecute(String result) {
  Toast.makeText(getBaseContext(), result, Toast.LENGTH_LONG).show();
  }
}
}

Order Solution Now

Our Service Charter

1. Professional & Expert Writers: Topnotch Essay only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided byTopnotch Essay are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Topnotch Essay is known for timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Topnotch Essay, we have put in place a team of experts who answer to all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.