use TV_Guide
update Countries
set country_FlagIcoLinkEncryptionInfo= d.couFlagIcoLinkEncryptionInfo
from
DishesOnline.dbo.Countries
d
where
country_NameEn = d.couNameEn
/First create a new URL object
URL url = new URL("http://www.google.co.uk/logos/holiday09_2.gif")
//Next create a file, the example below will save to the SDCARD using JPEG
// format
File file = new File("/sdcard/example.jpg");
//Next create a Bitmap object and download the image to bitmap
Bitmap bitmap = BitmapFactory.decodeStream(url.openStream());
//Finally compress the bitmap, saving to the file previously created
bitmap.compress(CompressFormat.JPEG, 100, new FileOutputStream(file));
Don't forget to add the Internet permission to your manifest:
android:name="android.permission.INTERNET" />
Mohammad Abu Hmead
Bitmap bitmap = ((BitmapDrawable)listItemIconDrawableObject).getBitmap(); BitmapDrawable d = new BitmapDrawable(bitmap); //use d whenever you want
public Drawable getDrwableFromBytes(byte[] imageBytes) {
if (imageBytes != null)
return new BitmapDrawable(BitmapFactory.decodeByteArray(imageBytes,
0, imageBytes.length));
else
return null;
}
Replace in MSSQL
use Satellites
Declare @ss as nvarchar(400)
set @ss ='.png'
Update dbo.Frequencies_Owners
Set logoLink = REPLACE(cast(logoLink as nvarchar(max)), @ss, '')
try {
if (writeFile("sdcard/strs.txt", "My string runs here"))
Log.i("WriteFil", "Success");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
/**
* This method to create text file or append to a text file
*
* @param fullFileLocationBathWithNameAndExten
* like "sdcard/strs.txt"
* @param text
* : the text which will be written in the file
* @return: sucess if the process finished successfully
* @throws IOException
* : error in creating the file
*/
public boolean writeFile(String fullFileLocationBathWithNameAndExten,
String text) throws IOException {
File file = new File(fullFileLocationBathWithNameAndExten);
if (!file.exists()) {
file.createNewFile();
}
// BufferedWriter for performance, true to set append to file flag
BufferedWriter buf = new BufferedWriter(new FileWriter(file, true));
buf.append(text);
buf.newLine();
buf.close();
return true;
}
public void onItemClick(AdapterView parent, View selectedView,
int selectedViewPos, long rowId) {
MyListAdapter myListAdapter = (MyListAdapter) ((ListView) selectedView
.getParent()).getAdapter();
if(myListAdapter==la1){
//write each list item event here or write your code for list1
}else if(myListAdapter==la2){
//write each list item event here or write your code for list2
}else if(myListAdapter==la3){
//write each list item event here or write your code for list3
}
//or
public void onItemClick(AdapterView parent, View selectedView,
int selectedViewPos, long rowId) {
ListView myListView =((ListView) selectedView.getParent());
if(myListView ==lv1){
//write each list item here event or write your code for list1
}else if(myListView ==lv2){
//write each list item here event or write your code for list2
}else if(myListView ==lv3){
//write each list item here event or write your code for list3
}
setContentView(R.layout.main_window);
LayoutInflater layoutInflater = (LayoutInflater) getBaseContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View row = layoutInflater.inflate(R.layout.mySeperatedXMLLayout,null);
ListView leftList = (ListView) row.findViewById(R.id.leftList);
leftList .setAdapter(new IconAndTextListAdapter(getBaseContext(),
R.layout.icon_and_text, new Contents()
.getCountriesFlagsLinks("en"), new Contents()
.getCountriesNames("en"), R.id.icon_view,
R.id.text_view));
ListView categoriesList = (ListView) row.findViewById(R.id.rightList);
categoriesList.setAdapter(new IconAndTextListAdapter(getBaseContext(),
R.layout.icon_and_text, new Contents()
.getCountriesFlagsLinks("en"), new Contents()
.getCountriesNames("en"), R.id.icon_view,
R.id.text_view));
TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost);
tabHost.setup();
TabSpec setContent = tabHost.newTabSpec("Tab1")
.setIndicator("Countries").setContent(new TabHost.TabContentFactory() {
public View createTabContent(String tag) {
return row;
}});
tabHost.addTab(setContent);
// Commentandroid:id="@+id/doubList_tbL"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/rock_bg"
android:stretchColumns="0" >
android:id="@+id/leftList"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="5dp"
android:layout_weight=".50"
android:cacheColorHint="#00000000"
android:divider="@drawable/list_divider"
android:dividerHeight="10dp"
android:drawSelectorOnTop="false"
android:listSelector="@drawable/free_ico_color5"
android:scrollbars="vertical"
android:soundEffectsEnabled="true" />
android:id="@+id/rightList"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_marginLeft="5dp"
android:layout_marginRight="10dp"
android:layout_weight=".50"
android:cacheColorHint="#00000000"
android:drawSelectorOnTop="false"
android:listSelector="@drawable/paid_ico_color3"
android:scrollbars="vertical"
android:soundEffectsEnabled="true" />
// Commentandroid:layout_width="fill_parent"
android:layout_height="fill_parent" >
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/googlAd_view"
android:layout_alignParentTop="true" >
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" >
// Comment
public class IconAndTextListAdapter extends ArrayAdapter {
private final Context context;
private final String[] strings;
private final int[] iconsIDs;
private final int rowLayoutID, iconViewID, textViewID;
private View rowView ;
/**
* @param context
* @param rowLayoutID
* @param iconsIDs
* @param strings
* @param iconViewID
* @param textViewID
*/
public IconAndTextListAdapter(Context context, int rowLayoutID,
int[] iconsIDs, String[] strings, int iconViewID, int textViewID) {
super(context, rowLayoutID, strings);
this.context = context;
this.strings = strings;
this.iconsIDs = iconsIDs;
this.rowLayoutID = rowLayoutID;
this.iconViewID = iconViewID;
this.textViewID = textViewID;
// TODO Auto-generated constructor stub
}
static class ViewHolder {
public TextView text;
public ImageView image;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
rowView = convertView;
if (rowView == null) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
rowView = inflater.inflate(rowLayoutID, null);
ViewHolder viewHolder = new ViewHolder();
viewHolder.text = (TextView) rowView.findViewById(textViewID);
viewHolder.image = (ImageView) rowView.findViewById(iconViewID);
rowView.setTag(viewHolder);
}
ViewHolder holder = (ViewHolder) rowView.getTag();
holder.text.setText(strings[position]);
holder.image.setImageResource(iconsIDs[position]);
return rowView;
}
}
USE [DBName]
SELECT TOP 1 ID,targetLink,addPath,add_type
from dbo.advertisements
where targetDevices=@targetDevices
ORDER BY newid()
import javax.microedition.lcdui.*; |
import java.io.*; |