Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
P

pancakeleh

@pancakeleh
About
Posts
106
Topics
43
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Problem: Canvas onDraw Android
    P pancakeleh

    Hello! I have been trying to draw different rectangles on the canvas after several times of button click. It should display different colored rectangle and the rectangle should remain on canvas after every button click. The rectangles should be able to move around the canvas. I have 4 buttons on my main.xml file. After invoking the first button, a blue colored rectangle shld appear on the canvas. If the first button is invoked the second time, another blue colored rectangle shld appear as well however the code i have right now only appear one blue rectangle regardless the number of times the button is invoked. Here are my codes:

    public class DrawRectangle extends View {

    public DrawRectangle(Context context){

    super(context);
    

    }

    protected void onDraw(Canvas canvas) {
    // TODO Auto-generated method stub
    super.onDraw(canvas);

    	Rect ourRect = new Rect();
    	
    	ourRect.set(0, 0, canvas.getWidth()/4, canvas.getHeight()/4);
    	
    	Paint paintColor = new Paint();
    	
    	 // make the entire canvas white
        paintColor.setColor(Color.WHITE);
        canvas.drawPaint(paintColor);
    	
         
    	
    	if(MainActivity.isBlue){
            paintColor.setColor(Color.BLUE);
        }
    
        paintColor.setStyle(Paint.Style.FILL);
    
        //Draw to actual canvas
        canvas.drawRect(ourRect, paintColor);
        canvas.save();
        
        if(MainActivity.isRed){
            paintColor.setColor(Color.RED);
        }
    
        paintColor.setStyle(Paint.Style.FILL);
    
        //Draw to actual canvas
        canvas.drawRect(ourRect, paintColor);
        canvas.save();
        
        if(MainActivity.isYellow){
            paintColor.setColor(Color.YELLOW);
        }
    
        paintColor.setStyle(Paint.Style.FILL);
        canvas.save();
    
        //Draw to actual canvas
        canvas.drawRect(ourRect, paintColor);
        
        if(MainActivity.isGreen){
            paintColor.setColor(Color.GREEN);
        }
    
        paintColor.setStyle(Paint.Style.FILL);
    
        //Draw to actual canvas
        canvas.drawRect(ourRect, paintColor);
        canvas.save();
        
        
        }
        
    } 
    

    and this is my code for my first button:

    public static boolean isBlue, isRed, isYellow, isGreen;
    DrawRectangle dv;

    bluebutton.setOnClickListener(new View.OnClickListener() {

    	@Override
    	public void onClick(View arg0) {
    		
    		// TODO Auto-generated method stub
    		isBlue = true;
            isRed = false;
            isGreen = false;
            isYellow = false;
       
             
            dv.inv
    
    Android android xml help

  • SVG Android
    P pancakeleh

    Hello all, I have met problems dealing with the SVG-android library. In my main activity I want to display the SVG object on the imageview however, i am facing this error.

    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.androidsvgdemo/com.example.androidsvgdemo.MainActivity}: com.larvalabs.svgandroid.SVGParseException: org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 0: not well-formed (invalid token)

    My codes are as follows:

    package com.example.androidsvgdemo;

    import android.os.Bundle;
    import android.app.Activity;
    import android.view.Menu;

    import com.larvalabs.svgandroid.SVG;
    import com.larvalabs.svgandroid.SVGParser;

    import android.os.Bundle;
    import android.widget.ImageView;
    import android.app.Activity;

    public class MainActivity extends Activity {

    ImageView imageView;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
    	setContentView(R.layout.activity\_main);
    	
    	imageView = (ImageView)findViewById(R.id.img1);
        //Parse the SVG file from the resource
        SVG svg = SVGParser.getSVGFromResource(getResources(), R.raw.imageandroid);
        //Get a drawable from the parsed SVG and apply to ImageView
        imageView.setImageDrawable(svg.createPictureDrawable());
    	
    }
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
    	// Inflate the menu; this adds items to the action bar if it is present.
    	getMenuInflater().inflate(R.menu.main, menu);
    	return true;
    }
    

    }

    Please advice. Thank you.

    Android java apache android com xml

  • [issue]org.apache.http.conn.HttpHostConnectException
    P pancakeleh

    oh, yup but it seems like others is able to run the application so I guess there is nothing wrong with the tutorial.Just that when I make changes to the tutorial to link with my server, it does not work.

    Android help php apache android mysql

  • [issue]org.apache.http.conn.HttpHostConnectException
    P pancakeleh

    Hello all, I am new to android mobile programming. Following this tutorial, http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/[^]. I have encountered several errors when I tried to register a new user or login. It does not allow me to connect to my xmapp server, I could not find out what is wrong. I have also added

    in my android manifest xml file but it still does not work. I have attached my errors in this email hoping that someone could help me out. This screenshot shows the error i am facing. http://i44.tinypic.com/9va61v.jpg[^] please advice thank you.

    Android help php apache android mysql

  • run .exe file in a panel
    P pancakeleh

    i have tried out and it works! but right now i am facing another problem! how do i adjust the panel width and height? I fixed my panel on the top left hand side with a width of 400px and height 400px. however after the button is being clicked, the exe appear but the position of the panel shifted. how do i ensure that the panel stays where it was as of before? and also before the exe file is being displayed in the panel, it will pop up the exe first. how can i do it in such a way that it wont pop up and will be displayed immediately in the panel?

    C# csharp question visual-studio tutorial

  • run .exe file in a panel
    P pancakeleh

    How to place a .exe file into the panel in visual studio windows form application c#. using this

    System.Diagnostics.Process.Start("calc.exe");

    the calculator.exe will pop up after a button is being clicked. how do i do it in a way such that the calculator is being displayed in the panel after the button is clicked? and also if i want to run another exe file of my own in this panel how do i go about doing it?

    C# csharp question visual-studio tutorial

  • how to solve?
    P pancakeleh

    when a button was being clicked, this screenshot as shown below occurs. what does the screenshot below tells? http://img822.imageshack.us/img822/7673/httperror.png[^]

    Java tutorial question

  • what does this mean?
    P pancakeleh

    oh the "prooperties.put" refers to writing to the properties file without having to key it in the properites file?

    modified on Monday, January 31, 2011 8:27 PM

    Java question

  • what does this mean?
    P pancakeleh

    yes i managed to figure out. i am teaching myself programming. Yes i manage to learn how to write a properties file alrdy..

    Java question

  • what does this mean?
    P pancakeleh

    i have this in my code:

    properties props = new properties();
    props.put("mail.transport.protocol", "smtps");

    How do i replace those "properties.put" without having to use the properties ?

    Java question

  • .properties file added to database
    P pancakeleh

    yeah you are right i am learning java on my own and my only hope is in here. Hope you guys will understand if i asked something really simple. Yes what i want to do is load the properties from the database instead of loading from a properties file. I have 3 properties files in the project. I manage to change 2 of them and still have 1 not done yet. I came across this problem for the third file. It is a .java file. My code as shown below:

    public class emailNotification {

    private static final String SMTP\_HOST\_NAME = getProperties("SMTP\_HOST\_NAME");
    private static final int SMTP\_HOST\_PORT = Integer.parseInt(getProperties("SMTP\_HOST\_PORT"));
    private static final String SMTP\_AUTH\_USER = getProperties("SMTP\_AUTH\_USER");
    private static final String SMTP\_AUTH\_PWD = getProperties("SMTP\_AUTH\_PWD");
    
    private emailNotification() {
    
    }
    

    I am unable to create a database connection in the public class even after i did the try and catch. Any idea how shld i do this? another question to ask:

            Properties props = new Properties();
            props.put("mail.transport.protocol", "smtps");
    

    The above code is to create a new property right? is it appropriate for me to use in my case whereby i will load the properties from the database instead of loading from a properties file.

    modified on Thursday, January 27, 2011 1:39 AM

    Java tutorial database question

  • .properties file added to database
    P pancakeleh

    i have got it. As previously i am using the properties file to get Property and i have this getProperty method as shown below:

    public static String getProperties(String inputProperty) {
    Properties props = new Properties();
    try {
    try {
    // Set the directory and the file name.
    props.load(Class.forName("......autoMessage").getResourceAsStream("autoMessage.properties"));
    } catch (ClassNotFoundException ex) {
    Logger.getLogger(autoMessage.class.getName()).log(Level.SEVERE, null, ex);
    }
    } catch (IOException ex) {
    Logger.getLogger(autoMessage.class.getName()).log(Level.SEVERE, null, ex);
    }
    String output = props.getProperty(inputProperty);
    return output;
    }

    Do i have to create a method in order to get the value from the database?

    Java tutorial database question

  • .properties file added to database
    P pancakeleh

    the code as shown below: http://img96.imageshack.us/img96/4586/errorwv.png[^] I have added the imports but however i am facing errors.

    Java tutorial database question

  • .properties file added to database
    P pancakeleh

    i am doing it in a .java file in netbeans however there is error when i try to connect to the database.. my profiles file includes the following as shown below: yahoo=http://yahoo.com google=http://google.com so i still use the key and value for my table?

    modified on Monday, January 24, 2011 10:59 PM

    Java tutorial database question

  • .properties file added to database
    P pancakeleh

    Hello i have 3 properties file consisting of information. Is it possible for me to add the information of 3 properties files into database and instead of getting properties from the properties file, i get the values from the database? however i have no idea on how to start anyone could guide me?

    Java tutorial database question

  • what does this errors means?
    P pancakeleh

    I had this delete button and when i click it this errors comes out.

    java.lang.RuntimeException: Number of conflicts while synchronizing: 1 SyncResolver.DELETE_ROW_CONFLICT row 4 more than one row matched delete statement

    how can i solve this?

    Java question java

  • ResultSet to Int [modified]
    P pancakeleh

    I have written a method in sessionBean named updateIncident for adding the values to the database. the codes as follows:

    public void updateIncident(Integer incidentIDName, String incidentNameName){
    
        incidentdataDataProvider.refresh();
    
        //Set new row
        RowKey rkUpdate = incidentedataDataProvider.appendRow();
    
        //Move to new created row
        incidentdataDataProvider.setCursorRow(rkUpdate);
    
        //Set Input
         incidentdataDataProvider.setValue("INCIDENTDATA.INCIDENTID", incidentIDName);
         incidentdataDataProvider.setValue ("INCIDENTDATA.INCIDENTNAME", incidentNameName);
    
       incidentdataDataProvider.refresh();
    
    }
    
    Java database question debugging help tutorial

  • ResultSet to Int [modified]
    P pancakeleh

    I have made changes to the codes. Right now i dont face any error but however i dont see the value that i have added, being added to the table.

    public String add_btn_action() throws SQLException {
    ResultSet rs = null;
    Statement stmt = null;

        Integer id;
        String dbURL = "....";
    
        String incidentId = (String) getIncidentidtxt().getValue();
        Integer incidentIntId = Integer.parseInt(incidentId);
        String incidentName = (String) getIncidentnametxt().getValue();
    
        Connection con = DriverManager.getConnection(dbURL);
    
        try{
    
             stmt = con.createStatement();
    
             rs = stmt.executeQuery("Select COUNT(1) from INCIDENTDATA where INCIDENTID = "+incidentIntId+"");
    
             while(rs.next()){
    
             id = rs.getInt(1);
    
          
             if( id == 0){
    
            getSessionBean1().updateIncident(incidentIntId, incidentName);
            incidentdataDataProvider.refresh();
             }
    
              else{
    
        Integer newIncidentID =  incidentIntId + 1;
    
        getSessionBean1().updateIncident(newIncidentID, incidentName);
        instancedataDataProvider.refresh();
        }
             }
    
    }
    catch(Exception e){
        e.getMessage();
    }
        
        return null;
    }
    

    Needing help..

    Java database question debugging help tutorial

  • ResultSet to Int [modified]
    P pancakeleh

    How to convert ResultSet to Integer? i do it this way however i encountered errors. codes as follows:

     rs = stmt.executeQuery("Select count(1) from INCIDENTDATA where INCIDENTID = 10");
    
     Integer id = rs.getInt(1);
    
        if( id == 0){
          .
          .
          .
          }
    

    When i do a debug errors i encounted: 1. "id" is not a known variable in the current context.; 2. "rs" is not a known variable in the current context.; http://img841.imageshack.us/img841/1965/exeerror.png[^] needing help. When i execute the SQL this is the screen shot : http://img502.imageshack.us/img502/8532/executey.png[^] how do i get the value 0 so as to compare it if it is 0 then i will add the value 10 into the database?

    modified on Sunday, January 16, 2011 11:25 PM

    Java database question debugging help tutorial

  • Comparing values in the table with the value the user keyed in
    P pancakeleh

    i have further change my code as shown below:

         try{
    
         Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
    
        Connection con = DriverManager.getConnection(dbURL);
    
        stmt = con.createStatement();
    
        if(incidentidtxt != null){
      // rs = stmt.executeQuery("Select INCIDENTID from INCIDENTDATA where INCIDENTID = "+incidentStringNo+";");
    
             id = rs.getInt(1);
    
            if( id == 0){
    
    
                getSessionBean1().updateIncident(incidentId, instanceName);
    
            }
    
            else{
    
        Integer newIncidentID =  incidentId + 1;
    
         getSessionBean1().updateIncident(newIncidentID, instanceName);
        }
    
        }
        //}
        }
    
      catch (Exception ex) {
    
        log("ErrorDescription", ex);
              error(ex.getMessage());
    }
        return null;
    }
    
    Java question java database help tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups