Hi guys here we can find out some basics of c# and asp.net programs
and power point presentations .
ASP . Net presentations presentations
Programing in C# presentations
Dot Net Demo Programs presentations
dot net demo project presentations
Xml power point presentations presentations
WML power point presentaions
Aug 19, 2012
Aug 14, 2012
HorizontalScrollView And ScrollView
java.lang.Object | ||||
↳ | android.view.View | |||
↳ | android.view.ViewGroup | |||
↳ | android.widget.FrameLayout | |||
↳ | android.widget.HorizontalScrollView |
Class Overview
Layout container for a view hierarchy that can be scrolled by the user, allowing it to be larger than the physical display. A HorizontalScrollView is a
FrameLayout
, meaning you should place one child in it containing the entire contents to scroll; this child may itself be a layout manager with a complex hierarchy of objects. A child that is often used is a LinearLayout
in a horizontal orientation, presenting a horizontal array of top-level items that the user can scroll through.
The
TextView
class also takes care of its own scrolling, so does not require a HorizontalScrollView, but using the two together is possible to achieve the effect of a text view within a larger container.
HorizontalScrollView only supports horizontal scrolling. For vertical scrolling, use either
ScrollView
orListView
.
ScrollView and HorizontalScrollView are layout container for a view hierarchy that can be scrolled vertically or horizontally by the user, allowing it to be larger than the physical display. A ScrollView/HorizontalScrollView is a FrameLayout, meaning you should place one child in it containing the entire contents to scroll; this child may itself be a layout manager with a complex hierarchy of objects.
XML code :
------------
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="HorizontalScrollView And ScrollView "
/>
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="First HorizontalScrollView" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:text="Horizontal A1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:text="Horizontal A2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:text="Horizontal A3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:text="Horizontal A4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:text="Horizontal A5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Second HorizontalScrollView" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:text="Horizontal B1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:text="Horizontal B2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:text="Horizontal B3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:text="Horizontal B4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:text="Horizontal B5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:text="Horizontal B6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
<ScrollView
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Vertical ScrollView" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Button C"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Vertical ScrollView D"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Vertical ScrollView E"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Vertical ScrollView F"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Vertical ScrollView G"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Vertical ScrollView H"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Vertical ScrollView I"/>
</LinearLayout>
</ScrollView>
</LinearLayout>
For Full Source Clik Here : ScrollView
Aug 13, 2012
Android companies List In Vishakapatnam
Link Name
--------------------------------------------------------------
http://www.bluefrogindia.com blue frog
http://www.e-centricsolutions.com/ ecentric solutions
http://faqden.com/ faqden Labs
http://www.gaiansolutions.com/ gain softsoluations
http://www.jitworld.com jit world
http://www.stellentsoft.com/ stellen and soft
http://www.xinthe.com Xinthe technologies
http://www.vizser.com vizser limited
Real time Android training in Vishakapatnam
http://techtrainin.blogspot.in/p/android-programing.html
Aug 9, 2012
Showing a progress Bar When uploading File using FTP in Android
/**
* Asynchronous task to upload file to server
*/
class UploadImageTask extends AsyncTask<File, Integer, Boolean> {
/** Upload file to this url */
private static final String UPLOAD_URL = "http://thibault-laptop:8080/report";
/** Send the file with this form name */
private static final String FIELD_FILE = "file";
private static final String FIELD_LATITUDE = "latitude";
private static final String FIELD_LONGITUDE = "longitude";
/**
* Prepare activity before upload
*/
@Override
protected void onPreExecute() {
super.onPreExecute();
setProgressBarIndeterminateVisibility(true);
mConfirm.setEnabled(false);
mCancel.setEnabled(false);
showDialog(UPLOAD_PROGRESS_DIALOG);
}
/**
* Clean app state after upload is completed
*/
@Override
protected void onPostExecute(Boolean result) {
super.onPostExecute(result);
setProgressBarIndeterminateVisibility(false);
mConfirm.setEnabled(true);
mDialog.dismiss();
if (result) {
showDialog(UPLOAD_SUCCESS_DIALOG);
} else {
showDialog(UPLOAD_ERROR_DIALOG);
}
}
@Override
protected Boolean doInBackground(File... image) {
return doFileUpload(image[0], UPLOAD_URL);
}
@Override
protected void onProgressUpdate(Integer... values) {
super.onProgressUpdate(values);
if (values[0] == 0) {
mDialog.setTitle(getString(R.string.progress_dialog_title_uploading));
}
mDialog.setProgress(values[0]);
}
/**
* Upload given file to given url, using raw socket
* @see http://stackoverflow.com/questions/4966910/androidhow-to-upload-mp3-file-to-http-server
*
* @param file The file to upload
* @param uploadUrl The uri the file is to be uploaded
*
* @return boolean true is the upload succeeded
*/
private boolean doFileUpload(File file, String uploadUrl) {
HttpURLConnection conn = null;
DataOutputStream dos = null;
String lineEnd = "\r\n";
String twoHyphens = "--";
String boundary = "*****";
String separator = twoHyphens + boundary + lineEnd;
int bytesRead, bytesAvailable, bufferSize;
byte[] buffer;
int maxBufferSize = 1 * 1024 * 1024;
int sentBytes = 0;
long fileSize = file.length();
// The definitive url is of the kind:
// http://host/report/latitude,longitude
uploadUrl += "/" + mLocation.getLatitude() + "," + mLocation.getLongitude();
// Send request
try {
// Configure connection
URL url = new URL(uploadUrl);
conn = (HttpURLConnection) url.openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setUseCaches(false);
conn.setRequestMethod("PUT");
conn.setRequestProperty("Connection", "Keep-Alive");
conn.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary);
publishProgress(0);
dos = new DataOutputStream(conn.getOutputStream());
// Send location params
writeFormField(dos, separator, FIELD_LATITUDE, "" + mLocation.getLatitude());
writeFormField(dos, separator, FIELD_LONGITUDE, "" + mLocation.getLongitude());
// Send multipart headers
dos.writeBytes(twoHyphens + boundary + lineEnd);
dos.writeBytes("Content-Disposition: form-data; name=\"" + FIELD_FILE + "\";filename=\""
+ file.getName() + "\"" + lineEnd);
dos.writeBytes(lineEnd);
// Read file and create buffer
FileInputStream fileInputStream = new FileInputStream(file);
bytesAvailable = fileInputStream.available();
bufferSize = Math.min(bytesAvailable, maxBufferSize);
buffer = new byte[bufferSize];
// Send file data
bytesRead = fileInputStream.read(buffer, 0, bufferSize);
while (bytesRead > 0) {
// Write buffer to socket
dos.write(buffer, 0, bufferSize);
// Update progress dialog
sentBytes += bufferSize;
publishProgress((int)(sentBytes * 100 / fileSize));
bytesAvailable = fileInputStream.available();
bufferSize = Math.min(bytesAvailable, maxBufferSize);
bytesRead = fileInputStream.read(buffer, 0, bufferSize);
}
// send multipart form data necesssary after file data
dos.writeBytes(lineEnd);
dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
dos.flush();
dos.close();
fileInputStream.close();
} catch (IOException ioe) {
Log.e(TAG, "Cannot upload file: " + ioe.getMessage(), ioe);
return false;
}
// Read response
try {
int responseCode = conn.getResponseCode();
return responseCode == 200;
} catch (IOException ioex) {
Log.e(TAG, "Upload file failed: " + ioex.getMessage(), ioex);
return false;
} catch (Exception e) {
Log.e(TAG, "Upload file failed: " + e.getMessage(), e);
return false;
}
}
private void writeFormField(DataOutputStream dos, String separator, String fieldName, String fieldValue) throws IOException
{
dos.writeBytes(separator);
dos.writeBytes("Content-Disposition: form-data; name=\"" + fieldName + "\"\r\n");
dos.writeBytes("\r\n");
dos.writeBytes(fieldValue);
dos.writeBytes("\r\n");
}
}
Subscribe to:
Posts (Atom)