Android Open Source - Android-Media-Library Item Found Activity






From Project

Back to project page Android-Media-Library.

License

The source code is released under:

Apache License

If you think the Android project Android-Media-Library listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package grevian.MediaLibrary;
// w w w  . j ava 2  s  .  co m
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class ItemFoundActivity extends Activity 
{
  private Media mMedia;
  private Bundle extras;
  
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.details);
    
    extras = getIntent().getExtras();
    
    try {
        mMedia = MediaFactory.getMediaByUPC(this.getBaseContext(), extras.getString("UPC"));      
    }
    catch (LookupException e )
    {
      Toast toast = Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG);
          toast.show();
          this.finish();
          return;
    }
    
         TextView titleText = (TextView)findViewById(R.id.TitleText);
       titleText.setText(String.valueOf(mMedia.getTitle()));
    
    final TextView ownedText = (TextView)findViewById(R.id.CopiesText);
    ownedText.setText(Integer.toString(mMedia.getOwned()));
       
       if ( mMedia.getLoaned() != "" )
       {
         TextView loanedText = (TextView)findViewById(R.id.LoanedText);
         loanedText.setText(mMedia.getLoaned());
       }
    
    // Set up the button to add copies
    Button mButton = (Button)findViewById(R.id.AddButton);
    mButton.setOnClickListener(    
      new Button.OnClickListener() {
        public void onClick(View v) {
            mMedia.setOwned(mMedia.getOwned()+1);
            mMedia.save();
            ownedText.setText(Integer.toString(mMedia.getOwned()));
        }
    });

  }
  
}




Java Source Code List

grevian.MediaLibrary.ItemFoundActivity.java
grevian.MediaLibrary.LookupException.java
grevian.MediaLibrary.MediaContentProvider.java
grevian.MediaLibrary.MediaFactory.java
grevian.MediaLibrary.MediaLibrary.java
grevian.MediaLibrary.Media.java
grevian.MediaLibrary.TextSearchAdapter.java
grevian.MediaLibrary.UPCDataSource.java
grevian.MediaLibrary.UPCRESTSource.java
grevian.MediaLibrary.movieDetailsDatasource.java
org.xmlrpc.android.Base64Coder.java
org.xmlrpc.android.XMLRPCClient.java
org.xmlrpc.android.XMLRPCException.java
org.xmlrpc.android.XMLRPCFault.java
org.xmlrpc.android.XMLRPCSerializer.java