Search Results

Search found 265 results on 11 pages for 'rahul'.

Page 7/11 | < Previous Page | 3 4 5 6 7 8 9 10 11  | Next Page >

  • Displaying music list using custom lists instead of array adapters

    - by Rahul Varma
    Hi, I have displayed the music list in a list view. The list is obtained from a website. I have done this using Arraylist. Now, i want to iterate the same program using custom lists and custom adapters instead of array list. The code i have written using array lists is... public class MusicListActivity extends Activity { MediaPlayer mp; File mediaFile; TextView tv; TextView albumtext; TextView artisttext; ArrayList<String> al=new ArrayList<String>(); //ArrayList<String> al=new ArrayList<String>(); ArrayList<String> node=new ArrayList<String>(); ArrayList<String> filepath=new ArrayList<String>(); ArrayList<String> imgal=new ArrayList<String>(); ArrayList<String> album=new ArrayList<String>(); ArrayList<String> artist=new ArrayList<String>(); ListView lv; Object[] webImgListObject; String[] stringArray; XMLRPCClient client; String loginsess; HashMap<?, ?> siteConn = null; //ImageView im; Bitmap img; String s; int d; int j; StreamingMediaPlayer sm; int start=0; Intent i; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.openadiuofile); lv=(ListView)findViewById(R.id.list1); al=getIntent().getStringArrayListExtra("titles"); //node=getIntent().getStringArrayListExtra("nodeid"); filepath=getIntent().getStringArrayListExtra("apath"); imgal=getIntent().getStringArrayListExtra("imgpath"); album=getIntent().getStringArrayListExtra("album"); artist=getIntent().getStringArrayListExtra("artist"); // ArrayAdapter<String> aa=new ArrayAdapter<String>(this,R.layout.row,R.id.text2,al); //lv.setAdapter(aa); try{ lv.setAdapter( new styleadapter(this,R.layout.row, R.id.text2,al)); }catch(Throwable e) { Log.e("openaudio error",""+e.toString()); goBlooey(e); } lv.setOnItemClickListener(new OnItemClickListener(){ @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3){ j=1; try{ d=arg2; String filep=filepath.get(d); String tit=al.get(d); String image=imgal.get(d); String singer=artist.get(d); String movie=album.get(d); sendpath(filep,tit,image,singer,movie); // getpath(n); }catch(Throwable t) { goBlooey(t); } } }); } @Override protected void onPause() { // TODO Auto-generated method stub super.onPause(); if(j==0) {i=new Intent(this,gorinkadashboard.class); startActivity(i);} } @Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); j=0; } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode==KeyEvent.KEYCODE_SEARCH) { Log.i("go","go"); return true; } return(super.onKeyDown(keyCode, event)); } public void sendpath(String n,String nn,String image,String singer,String movie) { Intent ii=new Intent(this,MusicPlayerActivity.class); ii.putExtra("path",n); ii.putExtra("titletxt",nn); //ii.putStringArrayListExtra("playpath",filepath); ii.putExtra("pos",d); ii.putExtra("image",image); ii.putStringArrayListExtra("imagepath",imgal); ii.putStringArrayListExtra("filepath", filepath); ii.putStringArrayListExtra("imgal", imgal); ii.putExtra("movie" ,movie ); ii.putExtra("singer",singer); ii.putStringArrayListExtra("album", album); ii.putStringArrayListExtra("artist",artist); ii.putStringArrayListExtra("tittlearray",al); startActivity(ii); } class styleadapter extends ArrayAdapter<String> { Context context=null; public styleadapter(Context context, int resource, int textViewResourceId, List<String> objects) { super(context, resource, textViewResourceId, objects); this.context=context; } @Override public View getView(int position, View convertView, ViewGroup parent) { final int i=position; LayoutInflater inflater = ((Activity) context).getLayoutInflater(); View v = inflater.inflate(R.layout.row, null); tv=(TextView)v.findViewById(R.id.text2); albumtext=(TextView)v.findViewById(R.id.text3); artisttext=(TextView)v.findViewById(R.id.text1); tv.setText(al.get(i)); albumtext.setText(album.get(i)); artisttext.setText(artist.get(i)); final ImageView im=(ImageView)v.findViewById(R.id.image); s="http://www.gorinka.com/"+imgal.get(i); // displyimg(s,v); // new imageloader(s,im); String imgPath=s; AsyncImageLoaderv asyncImageLoaderv=new AsyncImageLoaderv(); Bitmap cachedImage = asyncImageLoaderv.loadDrawable(imgPath, new AsyncImageLoaderv.ImageCallback() { public void imageLoaded(Bitmap imageDrawable, String imageUrl) { im.setImageBitmap(imageDrawable); } }); im.setImageBitmap(cachedImage); return v; } } public class imageloader implements Runnable{ private String ss; //private View v; //private View v2; private ImageView im; public imageloader(String s, ImageView im) { this.ss=s; //this.v2=v2; this.im=im; Thread thread = new Thread(this); thread.start(); } public void run(){ try { // URL url = new URL(ss); // URLConnection conn = url.openConnection(); // conn.connect(); HttpGet httpRequest = null; httpRequest = new HttpGet(ss); HttpClient httpclient = new DefaultHttpClient(); HttpResponse response = (HttpResponse) httpclient.execute(httpRequest); HttpEntity entity = response.getEntity(); BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity); InputStream is = bufHttpEntity.getContent(); // BufferedInputStream bis = new BufferedInputStream(is); Bitmap bm = BitmapFactory.decodeStream(is); Log.d("img","img"); // bis.close(); is.close(); im.setImageBitmap(bm); // im.forceLayout(); // v2.postInvalidate(); // v2.requestLayout(); } catch (Exception t) { Log.e("bitmap url", "Exception in updateStatus()", t); //goBlooey(t); // throw new RuntimeException(t); } } } private void goBlooey(Throwable t) { AlertDialog.Builder builder=new AlertDialog.Builder(this); builder .setTitle("Exception!") .setMessage(t.toString()) .setPositiveButton("OK", null) .show(); } } I have created the SongList.java, SongsAdapter.java and also SongsAdapterView.java. Their code is... public class SongsList { private String titleName; private String movieName; private String singerName; private String imagePath; private String mediaPath; // Constructor for the SongsList class public SongsList(String titleName, String movieName, String singerName,String imagePath,String mediaPath ) { super(); this.titleName = titleName; this.movieName = movieName; this.singerName = singerName; this.imagePath = imagePath; this.mediaPath = mediaPath; } public String gettitleName() { return titleName; } public void settitleName(String titleName) { this.titleName = titleName; } public String getmovieName() { return movieName; } public void setmovieName(String movieName) { this.movieName = movieName; } public String getsingerName() { return singerName; } public void setsingerName(String singerName) { this.singerName = singerName; } public String getimagePath() { return imagePath; } public void setimagePath(String imagePath) { this.imagePath = imagePath; } public String getmediaPath() { return mediaPath; } public void setmediaPath(String mediaPath) { this.mediaPath = mediaPath; } } public class SongsAdapter extends BaseAdapter{ private Context context; private List<SongsList> listSongs; public SongsAdapter(Context context, List<SongsList> listPhonebook){ this.context = context; this.listSongs = listSongs; } public int getCount() { return listSongs.size(); } public Object getItem(int position) { return listSongs.get(position); } public long getItemId(int position) { return position; } public View getView(int position, View view, ViewGroup viewGroup) { SongsList entry = listSongs.get(position); return new SongsAdapterView(context,entry); } } public SongsAdapterView(Context context, SongsList entry) { super(context); this.setOrientation(VERTICAL); this.setTag(entry); // TODO Auto-generated constructor stub View v = inflate(context, R.layout.row, null); TextView tvTitle = (TextView)v.findViewById(R.id.text2); tvTitle.setText(entry.gettitleName()); TextView tvMovie = (TextView)v.findViewById(R.id.text3); tvTitle.setText(entry.getmovieName()); TextView tvSinger = (TextView)v.findViewById(R.id.text1); tvTitle.setText(entry.getsingerName()); addView(v); } } Can anyone please tell me how to display the list using custom lists and custom adapters using the code above???

    Read the article

  • problem in displaying list using array adapters

    - by Rahul Varma
    Hi, I am trying to display the list of songs using array adapters. But the problem is i couldnt display the list and only empty screen with preset background is showing up. Here's the code...All the thee are seperate classes... Plz help me... public class SongsAdapter extends ArrayAdapter<SongsList>{ private Context context; TextView tvTitle; TextView tvMovie; TextView tvSinger; String s; public SongsAdapter(Context context, int resource, int textViewResourceId, String title) { super(context, resource, textViewResourceId); this.context=context; } public View getView(int position, View convertView, ViewGroup parent) { final int i=position; List<SongsList> listSongs = new ArrayList<SongsList>(); String title = listSongs.get(i).gettitleName().toString(); String album = listSongs.get(i).getmovieName().toString(); String artist = listSongs.get(i).getsingerName().toString(); String imgal = listSongs.get(i).gettitleName().toString(); LayoutInflater inflater = ((Activity) context).getLayoutInflater(); View v = inflater.inflate(R.layout.row, null); tvTitle=(TextView)v.findViewById(R.id.text2); tvMovie=(TextView)v.findViewById(R.id.text3); tvSinger=(TextView)v.findViewById(R.id.text1); tvTitle.setText(title); tvMovie.setText(album); tvSinger.setText(artist); final ImageView im=(ImageView)v.findViewById(R.id.image); s="http://www.gorinka.com/"+imgal; String imgPath=s; AsyncImageLoaderv asyncImageLoaderv=new AsyncImageLoaderv(); Bitmap cachedImage = asyncImageLoaderv.loadDrawable(imgPath, new AsyncImageLoaderv.ImageCallback() { public void imageLoaded(Bitmap imageDrawable, String imageUrl) { im.setImageBitmap(imageDrawable); } }); im.setImageBitmap(cachedImage); return v; } public class imageloader implements Runnable{ private String ss; private ImageView im; public imageloader(String s, ImageView im) { this.ss=s; this.im=im; Thread thread = new Thread(this); thread.start(); } public void run(){ try { HttpGet httpRequest = null; httpRequest = new HttpGet(ss); HttpClient httpclient = new DefaultHttpClient(); HttpResponse response = (HttpResponse) httpclient.execute(httpRequest); HttpEntity entity = response.getEntity(); BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity); InputStream is = bufHttpEntity.getContent(); Bitmap bm = BitmapFactory.decodeStream(is); Log.d("img","img"); is.close(); im.setImageBitmap(bm); } catch (Exception t) { Log.e("bitmap url", "Exception in updateStatus()", t); } } } } public class SongsList { private String titleName; private String movieName; private String singerName; private String imagePath; private String mediaPath; // Constructor for the SongsList class public SongsList(String titleName, String movieName, String singerName,String imagePath,String mediaPath ) { super(); this.titleName = titleName; this.movieName = movieName; this.singerName = singerName; this.imagePath = imagePath; this.mediaPath = mediaPath; } public String gettitleName() { return titleName; } public void settitleName(String titleName) { this.titleName = titleName; } public String getmovieName() { return movieName; } public void setmovieName(String movieName) { this.movieName = movieName; } public String getsingerName() { return singerName; } public void setsingerName(String singerName) { this.singerName = singerName; } public String getimagePath() { return imagePath; } public void setimagePath(String imagePath) { this.imagePath = imagePath; } public String getmediaPath() { return mediaPath; } public void setmediaPath(String mediaPath) { this.mediaPath = mediaPath; } } public class MusicListActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.openadiuofile); ListView list = (ListView)findViewById(R.id.list1); SongsAdapter adapter = new SongsAdapter(this,R.layout.row, R.id.text2, null); list.setAdapter(adapter); } }

    Read the article

  • Displaying the Time in AM/PM format in android

    - by Rahul Varma
    Hi, I am getting the time using a time picker and displaying the time in the text view using following code... private TimePickerDialog.OnTimeSetListener mTimeSetListener = new TimePickerDialog.OnTimeSetListener() { public void onTimeSet(TimePicker view, int hourOfDay, int minute) { Toast.makeText(SendMail.this, "Your Appointment time is "+hourOfDay+":"+minute, Toast.LENGTH_SHORT).show(); TextView datehid = (TextView)findViewById(R.id.timehidden); datehid.setText(String.valueOf(hourOfDay)+ ":"+(String.valueOf(minute))); } }; Now, the issue is when i set the time as 8:00 pm then i get the time displayed as 20:0... I want to display the time as 8:00 pm... How can i do that???

    Read the article

  • Generic Method to find the tuples used for computation in Postgres?

    - by Rahul
    If I have a table col1 | name | pay ------+------------------+------ 1 | Steve Jobs | 1006 2 | Mike Markkula | 1007 3 | Mike Scott | 1978 4 | John Sculley | 1983 5 | Michael Spindler | 1653 The user executes a sum query which sums the pay of people getting paid more than $1500. Is there a way to also implicitly know which tuples have been used which satisfy the condition for sum ? I know you can separately write another query to just return the primary key ids which satisfy the condition. But, Is there any other way to do that in the same query ? probably rewrite the query in some way ? or... any suggestion ?

    Read the article

  • Binding data to scroll view

    - by Rahul Varma
    Hi, I am new to iphone dev. I have a Label and a scroll view. I am trying to get data from url and bind it to label and a scroll view. I am able to bind the data to label by using... UrlValues *asana=[[data yoga]objectAtIndex:i]; self.AsanaName.text = [asana asanatitle]; Similarly i want to bind some other data in the url to a scroll view. The data i want to bind is 4 or 5 sentences. So, can anyone help me how to do it... Any sample code will be really helpful... Thanks

    Read the article

  • Getting the values from an array in android

    - by Rahul Varma
    Hi, I have a collection of strings and declared the strings individually as arrays using ArrayList<String> al=new ArrayList<String>(); and called the arrays in the program by using al=getIntent().getStringArrayListExtra("titles"); Now, instead of declaring each of the arrays i have created SongsArray.java like below... public class SongsArray { private String title; private String movieName; private String singerName; private String imagePath; private String mediaPath; public String gettitle() { return title; } public void settitle(String title) { this.title = title; } public String getmovieName() { return movieName; } public void setmovieName(String movieName) { this.movieName = movieName; } public String getsingerName() { return singerName; } public void setsingerName(String singerName) { this.singerName = singerName; } public String getimagePath() { return imagePath; } public void setimagePath(String imagePath) { this.imagePath = imagePath; } public String getmediaPath() { return mediaPath; } public void setmediaPath(String mediaPath) { this.mediaPath = mediaPath; } } Now i want to call the arrays that i have declared. How can i do that???

    Read the article

  • Where can I find a list of all possible messages that an XmlException can contain?

    - by Rahul
    I'm writing an XML code editor and I want to display syntax errors in the user interface. Because my code editor is strongly constrained to a particular problem domain and audience, I want to rewrite certain XMLException messages to be more meaningful for users. For instance, an exception message like this: '"' is an unexpected token. The expected token is '='. Line 30, position 35 .. is very technical and not very informative to my audience. Instead, I'd like to rewrite it and other messages to something else. For completeness' sake that means I need to build up a dictionary of existing messages mapped to the new message I would like to display instead. To accomplish that I'm going to need a list of all possible messages XMLException can contain. Is there such a list somewhere? Or can I find out the possible messages through inspection of objects in C#? Edit: specifically, I am using XmlDocument.LoadXml to parse a string into an XmlDocument, and that method throws an XmlException when there are syntax errors. So specifically, my question is where I can find a list of messages applied to XmlException by XmlDocument.LoadXml. The discussion about there potentially being a limitless variation of actual strings in the Message property of XmlException is moot.

    Read the article

  • Interesting interview question. .Net

    - by rahul
    Coding Problem NumTrans There is an integer K. You are allowed to add to K any of its divisors not equal to 1and K. The same operation can be applied to the resulting number and so on. Notice that starting from the number 4, we can reach any composite number by applying several such operations. For example, the number 24 can be reached starting from 4 using 5 operations: 468121824 You will solve a more general problem. Given integers n and m, return the minimal number of the described operations necessary to transform n into m. Return -1 if m can't be obtained from n. Definition Method signature: int GetLeastCount (int n, int m) Constraints N will be between 4 and 100000, inclusive. M will be between N and 100000, inclusive. Examples 1) 4 576 Returns: 14 The shortest order of operations is: 468121827365481108162243324432576 2) 8748 83462 Returns: 10 The shortest order of operations is: 874813122196832624439366590497873283106834488346083462 3) 4 99991 Returns: -1 The number 99991 can't be obtained because it’s prime!

    Read the article

  • How to validate SWT form?

    - by Rahul
    Label label1 = new Label(container, SWT.NULL); label1.setText("Enter the Password "); text1 = new Text(container, SWT.BORDER | SWT.PASSWORD); text1.setText(""); text1.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent e) { } public void keyReleased(KeyEvent e) { if (!text5.getText().isEmpty()) { setPageComplete(false); } } }); hi, i am creating form using SWT in eclipse can anyone tell me how to validate that form entry above is the sample code of that..actually i want to validate password field it should be minimum length of 6.How to do this please reply.

    Read the article

  • Interview question

    - by rahul
    Recenty I was asked this interview question: There is a server which receives millions of requests every day. Design an API for finding out hits in the last one minute, in the last 10 minutes etc. What should be the algorithm and design to implement it efficienly. I want to know the ideas on this.

    Read the article

  • Android adding HTML content on a webview without space

    - by Rahul
    I am trying to add an HTML content to a web view. If the words in the HTML content are without spaces then webview keeps that particular word on the same line.I want that content to be wrapped and be on the next line.Is it possible to do that.I am attaching a sample code that can reproduce the issue. String temp="<p>WebViewallowsyoutocreateyourownwindowforviewingwebpages(orevendevelopacompletebrowser).Inthistutorial,youcreateasimpleActivitythatcanviewandnavigatewebpages.1.CreateanewprojectnamedHelloWebView.</p>"; WebView wb=new WebView(this); wb.loadDataWithBaseURL("", temp, "text/html", Encoding.UTF_8.toString(),""); setContentView(wb);

    Read the article

  • How to covert UTF8 string to UTF16 in JNI

    - by Er Rahul Rajkumar Gupta
    Can anyone please tell me that what is going on wrong with me in this code.Actually in following line of codes I am taking the path of sdcard in a string in jni (C code) and in concatenate function concatenating these manually using loop.The string returned by concatenate works fine but when I am converting it to jstring it prints garbage value in my logcat. Kindly tell me what is the problem. jstring str=(jstring)env->CallObjectMethod(sdcard,storagestring); const char jclass cfile=env->FindClass("java/io/File"); jmethodID fileid=env->GetMethodID(cfile,"<init>","(Ljava/lang/String;)V"); jclass envir=env->FindClass("android/os/Environment"); jmethodID storageid=env->GetStaticMethodID(envir,"getExternalStorageDirectory","()Ljava/io/File;"); jobject sdcard=env->CallStaticObjectMethod(envir,storageid); jclass sdc=env->GetObjectClass(sdcard); jmethodID storagestring=env->GetMethodID(sdc,"toString","()Ljava/lang/String;"); *nativeString = env->GetStringUTFChars(str, 0); char *s =concatenate(nativeString,"/f1.3gp"); //fpath=s; fpath=env->NewStringUTF(s); jobject fobject=env->NewObject(cfile,fileid,fpath); LOGI("size of char=%d size of string=%d",sizeof("/f1.3gp"),sizeof(fpath)); jmethodID existid=env->GetMethodID(cfile,"exists","()Z"); if(env->CallBooleanMethod(fobject,existid)) { jmethodID delid=env->GetMethodID(cfile,"delete","()Z"); if(env->CallBooleanMethod(fobject,delid)) LOGE("File is deleting...%s",env->NewStringUTF("/f1.3gp")); } jmethodID newfileid=env->GetMethodID(cfile,"createNewFile","()Z"); if(env->CallBooleanMethod(fobject,newfileid)) LOGE("dig dig %s",fpath); jthrowable exc=env->ExceptionOccurred(); if(exc) { env->ExceptionDescribe(); env->ExceptionClear(); } LOGE("creating file %s",fpath); }

    Read the article

  • Issues with SharePoint 2010 Development

    - by Rahul Soni
    I am planning to use my laptop for SharePoint 2010 development and I have only 4 GB RAM which is not even upgradable. Just because of RAM constraint, my VS 2010 keeps crawling if I try to run it along with SharePoint 2010 on the same machine. Hence, I've reformatted my machine and looking for alternate solutions until I get a new laptop. Currently, I have installed VS 2010 ONLY on my laptop and wanted to create an empty SharePoint project. Once done with my project, I want to deploy it on a different machine (which is a 4GB RAM machine as well, but contains only SharePoint 2010). I thought this will work and give me a bit of breather if everything is configured well. Unfortunately, when I tried creating a new SharePoint Empty Project in VS 2010, it says... A SharePoint server is not installed on this computer. A SharePoint server must be installed to work with SharePoint projects. Is there a way out?

    Read the article

  • Tortoise SVN revision history

    - by rahul
    I want to know for how long the tortoise svn keeps the revision history. Say I have a file which I deleted from repository through repo browser an year ago, will I be able to still recover that file? If I am able to recover, I also want to know the method to permanently delete that earlier copy of file and related revisions history so that in future nobody is able to access that file. Is it possible? I have run into problems in my organisation as I did frequent updations and deletions assuming that file was getting deleted permanently. The file system of repository has bloated now. Please suggest how to fix it.

    Read the article

  • Need some ignition in Embedded Systems

    - by Rahul
    I'm very much interested in building applications for Embedded Devices. I'm in my 3rd year Electrical Engineering and I'm passionate about coding, algorithms, Linux OS, etc. And also by Googling I found out that Linux OS is one of the best OSes for Embedded devices(may be/may not be). I want to work for companies which work on mobile applications. I'm a newbie/naive to this domain & my skills include C/C++ & MySQL. I need help to get started in the domain of Embedded Systems; like how/where to start off, Hardware prerequisites, necessary programming skills, also what kind of Embedded Applications etc. I've heard of ARM, firmware, PIC Micorcontrollers; but I don't know anything & just need proper introduction about them. Thanx. P.S: I'm currently reading Bjarne Struotsup's lecture in C++ at Texas A&M University, and one chapter in it describes about Embedded Systems Programming.

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11  | Next Page >