Answer:
1)Responsive design is the idea where all the developed pages are embedded with model,view
and controller in the same page of the design so that it is easy for the user to transfer the data
from model to view and view to model.This also reduces the burden on the server when the user
makes any request all the form elements will not reach the server in responsive design but makes
the specific action element to reach the server and gives the output to the user.
2)Application templates in android involves both the layouts and UI components which are used
to build the design pages of the front end of the page.The common layouts which are used are
Gird Layout,Flow Layout,Relative Layout and UI components such as
listview,gridview,spinner,togglebuttons,radiobuttons,progressbar etc are used in any of the front
end design of the android for application to develop.We use XML for the design of the front end
in design in the application.
Android Application :
Note : Deploy the below files in Eclipse Id or Android Studio and run
MainActivity.java
package com.example.listviewcustom;
import java.io.File;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/*
String path=\"/storage/sdcard0/sample_images/\";
File f=new File(path);
if(f.exists()){
String[] files=f.list();
ArrayAdapter adapter=new ArrayAdapter(getApplicationContext(),
android.R.layout.simple_spinner_dropdown_item,files );
*/
ListView lView=(ListView)findViewById(R.id.listView1);
lView.setAdapter(new MyAdapter(this));
/*
}else{
Toast.makeText(getApplicationContext(), \"Path is not available ....\",2000).show();
}
*/
}
public void reload(){
ListView lView=(ListView)findViewById(R.id.listView1);
lView.setAdapter(new MyAdapter(this));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
MyAdapter.java
package com.example.listviewcustom;
import java.io.File;
import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView.FindListener;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
public class MyAdapter extends BaseAdapter{
//String path=\"/storage/sdcard0/sample_images/\";
String path=\"/mnt/sdcard/sample_images/\";
File f=new File(path);
String[] files=f.list();
MainActivity activity;
public MyAdapter(MainActivity mActivity){
this.activity=mActivity;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return files.length;
}
@Override
public Object getItem(int position) {
// TODO Auto-.
Answer1)Responsive design is the idea where all the developed pag.pdf
1. Answer:
1)Responsive design is the idea where all the developed pages are embedded with model,view
and controller in the same page of the design so that it is easy for the user to transfer the data
from model to view and view to model.This also reduces the burden on the server when the user
makes any request all the form elements will not reach the server in responsive design but makes
the specific action element to reach the server and gives the output to the user.
2)Application templates in android involves both the layouts and UI components which are used
to build the design pages of the front end of the page.The common layouts which are used are
Gird Layout,Flow Layout,Relative Layout and UI components such as
listview,gridview,spinner,togglebuttons,radiobuttons,progressbar etc are used in any of the front
end design of the android for application to develop.We use XML for the design of the front end
in design in the application.
Android Application :
Note : Deploy the below files in Eclipse Id or Android Studio and run
MainActivity.java
package com.example.listviewcustom;
import java.io.File;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/*
String path="/storage/sdcard0/sample_images/";
File f=new File(path);
if(f.exists()){
2. String[] files=f.list();
ArrayAdapter adapter=new ArrayAdapter(getApplicationContext(),
android.R.layout.simple_spinner_dropdown_item,files );
*/
ListView lView=(ListView)findViewById(R.id.listView1);
lView.setAdapter(new MyAdapter(this));
/*
}else{
Toast.makeText(getApplicationContext(), "Path is not available ....",2000).show();
}
*/
}
public void reload(){
ListView lView=(ListView)findViewById(R.id.listView1);
lView.setAdapter(new MyAdapter(this));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
MyAdapter.java
3. package com.example.listviewcustom;
import java.io.File;
import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView.FindListener;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
public class MyAdapter extends BaseAdapter{
//String path="/storage/sdcard0/sample_images/";
String path="/mnt/sdcard/sample_images/";
File f=new File(path);
String[] files=f.list();
MainActivity activity;
public MyAdapter(MainActivity mActivity){
this.activity=mActivity;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return files.length;
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return position;
}
4. @Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public View getView(int position, View v, ViewGroup arg2) {
LayoutInflater inflater=LayoutInflater.from(activity);
v=inflater.inflate(R.layout.individual_view, null);
ImageView iv=(ImageView)v.findViewById(R.id.imageView1);
TextView tv1=(TextView)v.findViewById(R.id.textView1);
TextView tv2=(TextView)v.findViewById(R.id.textView2);
ImageView iv2=(ImageView)v.findViewById(R.id.imageView2);
final File f=new File(path+files[position]);
iv.setImageURI(Uri.fromFile(f));
tv1.setText(files[position]);
tv2.setText(f.length()/1024 + "kb");
iv2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
f.delete();
5. activity.reload();
}
});
return v;
}
}
AndroidManifest.xml
activity_main.xml
individual_view.xml
Solution
Answer:
1)Responsive design is the idea where all the developed pages are embedded with model,view
and controller in the same page of the design so that it is easy for the user to transfer the data
from model to view and view to model.This also reduces the burden on the server when the user
makes any request all the form elements will not reach the server in responsive design but makes
the specific action element to reach the server and gives the output to the user.
2)Application templates in android involves both the layouts and UI components which are used
to build the design pages of the front end of the page.The common layouts which are used are
Gird Layout,Flow Layout,Relative Layout and UI components such as
listview,gridview,spinner,togglebuttons,radiobuttons,progressbar etc are used in any of the front
end design of the android for application to develop.We use XML for the design of the front end
in design in the application.
Android Application :
Note : Deploy the below files in Eclipse Id or Android Studio and run
MainActivity.java
package com.example.listviewcustom;
import java.io.File;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
6. import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/*
String path="/storage/sdcard0/sample_images/";
File f=new File(path);
if(f.exists()){
String[] files=f.list();
ArrayAdapter adapter=new ArrayAdapter(getApplicationContext(),
android.R.layout.simple_spinner_dropdown_item,files );
*/
ListView lView=(ListView)findViewById(R.id.listView1);
lView.setAdapter(new MyAdapter(this));
/*
}else{
Toast.makeText(getApplicationContext(), "Path is not available ....",2000).show();
}
*/
}
public void reload(){
7. ListView lView=(ListView)findViewById(R.id.listView1);
lView.setAdapter(new MyAdapter(this));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
MyAdapter.java
package com.example.listviewcustom;
import java.io.File;
import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView.FindListener;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
public class MyAdapter extends BaseAdapter{
//String path="/storage/sdcard0/sample_images/";
String path="/mnt/sdcard/sample_images/";
File f=new File(path);
String[] files=f.list();
MainActivity activity;
8. public MyAdapter(MainActivity mActivity){
this.activity=mActivity;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return files.length;
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public View getView(int position, View v, ViewGroup arg2) {
LayoutInflater inflater=LayoutInflater.from(activity);
v=inflater.inflate(R.layout.individual_view, null);
ImageView iv=(ImageView)v.findViewById(R.id.imageView1);
TextView tv1=(TextView)v.findViewById(R.id.textView1);
TextView tv2=(TextView)v.findViewById(R.id.textView2);
ImageView iv2=(ImageView)v.findViewById(R.id.imageView2);